解决方法:
设置httpheader的时候,加上utf-8编码
1
2
3
4
5
6
7
|
String body = "中文你好"; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); HttpEntity< String > formEntity = new HttpEntity< String >(body, headers);
|
本文转自rongwei84n 51CTO博客,原文链接:http://blog.51cto.com/483181/1959017,如需转载请自行联系原作者