开发者

Handle special chars

When I do

WebClient wc = new WebClient();
string content = wc.DownloadString(url);
File.WriteAllTe开发者_StackOverflow社区xt(path, content);

And I open the file in path with Internet Explorer, special characters like ó apear like ó.

Is there a way for interpreting correctly those characters?


You're downloading it in whatever content encoding is specified, but then saving it as UTF-8. If you want to save it to disk anyway, I suggest you use WebClient.DownloadFile directly instead. Then so long as the encoding is also specified in the HTML (correctly) it should be okay.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜