ITeye博客

httpclient4 post 请求乱码

ap0406708 · 2016-01-04 20:53 · 移动开发 · Markdown

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);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。