httpclient4 post 请求乱码

http://my.oschina.net/u/1183927/blog/515969?p=1
1
2
3
4
5
6
HttpPost post=new HttpPost(url);
StringEntity content=new StringEntity(data, Charset.forName("utf-8"));// 第二个参数,设置后才会对,内容进行编码

content.setContentType("application/json; charset=UTF-8");
content.setContentEncoding("utf-8");
post.setEntity(content);

猜你喜欢

转载自ap0406708.iteye.com/blog/2268550