服务端返回的信息,我用抓包工具抓出来的:
HTTP/1.1 200 OK
Date: Thu, 28 Dec 2006 08:20:27 GMT
Content-Type: text/html;charset=GBK
Server: Microsoft-IIS/6.0
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
我用StreamReader将HTML内容读出来写入文本,却成了乱码。GB2312变成GB18030也不行,UTF-8也不行。写入文本的时候,我也用了同样的编码写入。
高人指点一下吧。阿门!using (streamReader = new StreamReader(response.GetResponseStream(),Encoding.GetEncoding("gb2312")))
{
result = streamReader.ReadToEnd();
streamReader.Close();
response.Close();
}