日期:2014-05-17 浏览次数:20898 次
为什么会出现乱码?怎么解决中文乱码问题?
WebRequest request = WebRequest.Create(url);
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
textBox2.Text = Convert.ToInt32(response.StatusCode) + " " + response.StatusCode.ToString();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream, Encoding.Default);
StringBuilder sb = new StringBuilder();
string rl;
while ((rl = reader.ReadLine()) != null)
{
sb.Append(rl);
}
//string responseFromServer = reader.ReadToEnd();
textBox3.Text = rl;