string url="abc";
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream s = response.GetResponseStream();
string strDate = "";
string strValue = "";
StreamReader reader = new StreamReader(s, Encoding.UTF8);
while ((strDate = reader.ReadLine()) != null)
{
strValue += strDate + "\r\n";
}
FileStream fs = new FileStream("D:\\text.txt", FileMode.Append);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
sw.Write(strValue);
sw.Close();
fs.Close();
存在以下问题:
1 当网站答复为json格式时,答复中的中文均为乱码