我测试了下
http://www.baidu.com  --  这个是GB2312的
http://www.cnblogs.com  --这个是UTF-8的我使用的UTF-8编码来采集数据的
但是,采集百度出来的数据就是乱码,采集博客园的数据就是“显码”
想问下,谁能解答下为什么,要如何解决?

解决方案 »

  1.   

    比如博客园返回HTTP/1.1 200 OK
    Cache-Control:public, max-age=42
    Content-Type:text/html; charset=utf-8
    Expires:Wed, 21 Sep 2011 12:39:08 GMT
    Last-Modified:Wed, 21 Sep 2011 12:38:08 GMT
    Server:Microsoft-IIS/7.5
    X-AspNet-Version:4.0.30319
    X-Powered-By:ASP.NET
    Date:Wed, 21 Sep 2011 12:38:25 GMT那么通过             HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
                Console.WriteLine ("Content type is {0}", response.ContentType);就可以显示其内容的下载类型。