gpt4 book ai didi

c# - 我无法在我的网站上显示阿拉伯语,是否存在编码问题?

转载 作者:太空宇宙 更新时间:2023-11-03 14:23:06 24 4
gpt4 key购买 nike

我在阿拉伯语页面上试过这段代码:

    tmlWeb hw = new HtmlWeb();
HtmlAgilityPack.HtmlDocument htmlDoc = hw.Load(@"http://www.reciter.org/KATHEER/002002.html");
if (htmlDoc.DocumentNode != null)
{
Response.Write(htmlDoc.DocumentNode.SelectSingleNode("//tr/td").InnerText);
}

结果是这样的:������
我该如何解决这个问题?

更新:

这段代码工作正常。

        string url = "http://www.reciter.org/KATHEER/002002.html";
string result = null;
WebClient client = new WebClient();
client.Encoding = System.Text.Encoding.GetEncoding("windows-1256");
result = client.DownloadString(url);
HtmlDocument htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(result);
if (htmlDoc.DocumentNode != null)
{
Response.Write(htmlDoc.DocumentNode.SelectSingleNode("//tr/td").InnerText);
}

最佳答案

设置您的响应编码。

Response.ContentEncoding

关于c# - 我无法在我的网站上显示阿拉伯语,是否存在编码问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4803538/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com