HttpClient中文乱码问题排查

可以尝试一下方法解决:

1、

httpPost.setHeader("Content-Type", "application/json; charset=UTF-8");  

2、

httpPost.setEntity(new UrlEncodedFormEntity(nvps,"utf-8"));

3、如果还是不行,可以试下这种

httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

entity.setContentType(ContentType.APPLICATION_JSON);

 

参考:

https://chenzhihao.cc/archives/153

https://www.cnblogs.com/yixiu868/p/6637645.html

http://blog.csdn.net/anloan/article/details/50471337

posted @ 2018-01-30 17:32  EasonJim  阅读(868)  评论(0编辑  收藏  举报