使用WebClient时,得到了乱码而不是希伯来语。

3

我正在尝试使用WebClient类查看希伯来语页面的内容,但是得到的是乱码而不是希伯来语。

我的代码如下:

using (WebClient webClient = new WebClient())
{
    webClient.Headers.Add(HttpRequestHeader.ContentType, "charset=windows-1255");
    string page = webClient.DownloadString("http://hebrew-academy.huji.ac.il/Pages/default.aspx");
}

我能正确接收英文内容,但希伯来语内容是乱码,例如:

<title> ׳”׳׳§׳“׳׳™׳” ׳׳׳©׳•׳ ׳”׳¢׳‘׳¨׳™׳× ג€“ ׳“׳£ ׳”׳‘׳™׳×</title>

有人知道如何正确获取希伯来语内容吗?

1个回答

8

当我使用以下代码时,得到相同的结果:webClient.Headers.Add(HttpRequestHeader.ContentType, "utf-8"); - Idan P
Content-Type当用作请求头时仅指定发送请求中的数据的内容类型,适用于POST和PUT方法。请查看我的编辑以进行修正。(Note: The translation provided assumes simplified Chinese.) - Matt Ball

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接