WebClient DownloadString UTF-8 not displaying international characters

谁说胖子不能爱 提交于 2019-12-05 11:33:55

I had the same problem. It seems that client.DownloadString doesn’t encode the characters using UTF-8. Using client.DownloadData and encoding the returned data with Encoding.UTF8.GetString solve the problem.

using (WebClient client = new WebClient())
{
     var htmlData = client.DownloadData("http://www.filmweb.pl/Mroczne.Widmo");
     var htmlCode = Encoding.UTF8.GetString(htmlData);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!