WeChat development--Custom menu query garbled code cracking method

高洛峰
Release: 2017-03-11 15:29:19
Original
1625 people have browsed it

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();
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!