开发者

I can't show arabic on my website, do I have an encoding issue?

开发者 https://www.devze.com 2023-02-07 00:13 出处:网络
I\'ve tried this code on an arabic page : tmlWeb hw = new HtmlWeb(); HtmlAgilityPack.HtmlDocument htmlDoc = hw.Load(@\"http://www.reciter.org/KATHEER/002002.html\");

I've tried this code on an arabic page :

    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);
    }

And the result was something like this : ������ �

How can I resolve this?

Update :

This code works fine.

        string url = "http://www.reciter.org/KATHEER/002002.html";
        string result = null;
        WebClient client = new WebClient();
        client.Encoding = System.Text.Encoding.G开发者_Python百科etEncoding("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);
        }


Set your Response encoding.

Response.ContentEncoding

0

精彩评论

暂无评论...
验证码 换一张
取 消