|
楼主 |
发表于 2019-1-12 10:35:08
|
显示全部楼层
很奇怪, 我重新HttpWebResponse类写就不乱码.
var request = (HttpWebRequest)WebRequest.Create("");
var data = Encoding.UTF8.GetBytes(postData);
request.Method = "POST";
request.ContentType = "application/json;charset=UTF-8";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); |
|