获取自定义菜单查询返回的结果有乱码
解决方法:
1 2 3 4 5 6 7 8 9 10string Posturl =
"https://api.weixin.qq.com/cgi-bin/menu/get?access_token=Token"
;
//设置提交的相关参数
HttpWebRequest request = WebRequest.Create(Posturl) as HttpWebRequest;
//提交方式
request.Method =
"Get"
;
//编码格式
request.ContentType =
"text/html;charset=UTF-8"
;
HttpWebResponse respone = (HttpWebResponse)request.GetResponse();
StreamReader stream =
new
StreamReader(respone.GetResponseStream(), Encoding.UTF8);
string jsonstring = stream.ReadToEnd();
最后结果就没乱码了,流解码的时候要用UTF8
StreamReader stream = new StreamReader(respone.GetResponseStream(), Encoding.UTF8);