2011-01-26 7 views
2

私は、アラビア語のページにこのコードを試してみた:ウェブサイトにアラビア語を表示できません。エンコードに問題はありますか?

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

答えて

1

応答コードを設定します。

Response.ContentEncoding

+0

私はそうすることを試みた:Response.ContentEncoding = System.Text.Encoding.GetEncoding( "窓-1256")。しかし、「????????」と同じ問題がまだ残っています – Rawhi

+0

@Rawhi:次に、 'htmlDoc.DocumentNode.SelectSingleNode(" // tr/td ")の結果を確認してください。InnerText' – leppie

+0

ذلكالكتابلاريبفيههدىليمتقين。そのアラビア語 – Rawhi

関連する問題