C#如何获取网站网页的正常编码的源码内容???
我的方法如下,获取url为http://www.sohu.com就出现汉字乱码?对于日文登就更不用说了
如何让程序自动的识别???????????????????????????
public string WebClientGetSource(string url)
{
string source="";
try
{
WebClient client=new WebClient();
Stream data=client.OpenRead(url);
StreamReader reader=new StreamReader(data,Encoding.Unicode);
string strTemp="";
while((strTemp=reader.ReadLine())!=null)
{
source+=strTemp+"\r\n";
}
}
catch(WebException exp)
{
MessageBox.Show(exp.Message,"Exception");
}
return source;
}