解决方法:
设置httpheader的时候,加上utf-8编码
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);
原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/194488.html