WP如何将编码方式为GB2312的网页正常显示出来呢?
代码如下:
private void GetScoreCallback(IAsyncResult result)
{
try
{
HttpWebRequest request = (HttpWebRequest)result.AsyncState;
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
resData = reader.ReadToEnd();
ProcessResponseScore();
}
catch (Exception ee)
{
errorAsync = ee;
}
}
private void GetScoreCallback(IAsyncResult result)
{
try
{
HttpWebRequest request = (HttpWebRequest)result.AsyncState;
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream,new HtmlAgilityPack.Gb2312Encoding());
resData = reader.ReadToEnd();;
ProcessResponseScore();
}
catch (Exception ee)
{
errorAsync = ee;
}
}