自定义菜单创建后公众号菜单乱码?
java post 请求
public static String jsonPost(String url, JSONObject jsonObject){
CloseableHttpClient httpclient = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(url);
String response = null;
try {
StringEntity s = new StringEntity(jsonObject.toString());
s.setContentEncoding("UTF-8");
s.setContentType("application/json");//发送json数据需要设置contentType
post.setEntity(s);
HttpResponse res = httpclient.execute(post);
if(res.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
String result = EntityUtils.toString(res.getEntity());// 返回json格式:
response = JSONObject.toJSONString(result);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return response;
}