Home >WeChat Applet >WeChat Development >WeChat development--Custom menu query garbled code cracking method
This article mainly introduces WeChat development-the solution to the garbled code returned by custom menu query, which has a very good reference value. Let’s take a look at it with the editor
The results returned by getting the custom menu query are garbled
Solution:
string 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();
The final result will be garbled. Use UTF8 when decoding the stream.
StreamReader stream = new StreamReader(respone.GetResponseStream(), Encoding.UTF8 );
The above is the detailed content of WeChat development--Custom menu query garbled code cracking method. For more information, please follow other related articles on the PHP Chinese website!