【发布时间】:2011-09-28 14:53:35
【问题描述】:
可能重复:
Characters in string changed after downloading HTML from the internet
要重现我的问题,请查看以下代码 sn-p:
const string url = "http://serienjunkies.org/serie/glee/";
var webclient = new WebClient();
var source = webclient.DownloadString(url);
Console.WriteLine(source.Substring(0, 200);
有时(使用完全相同的代码)我得到了正确的 html 源代码,而有时只是一个带有奇数字符的不可读字符串。如果你得到一个 - 等待几秒钟到一分钟 - 然后你会得到另一个。
预期结果:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
...
另一个结果(从cmd复制、粘贴):
▼ ♥????????y]2?? em§?.f♦∟3Hf??J?XRM*???%??9 Gf¶##R1p?-??;?♥???♀???U?M?I?s &?#9???⌂?????fg????o????????????;}-????v⌂???^go????????zu???????tD?u^M?h:?
...
谢谢。
亲切的问候,丹尼
【问题讨论】: