Code
Stream respStream = resp.GetResponseStream();
由于需要对返回的respStream进行字符编码检测:
Code
byte[] detectBuffer = new byte[4096];
int nbytes = 0;
while ((nbytes = respStream.Read(detectBuffer, 0, detectBuffer.Length)) != 0 && !det.IsDone())
{
// 检测字符编码
det.HandleData(detectBuffer, 0, nbytes);
}
检测结束后:
Code
StreamReader reader = new StreamReader(respStream, det.Encoding);
string source = reader.ReadToEnd();
问题出现:
source 缺失了一部分内容!
请教:如何解决这个问题?