开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜