标签:pen pre 中文乱码问题 ToJson ons temp dia headers form
RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); String jsonStr = JSONObject.toJSONString(params); HttpEntity formEntity = new HttpEntity( jsonStr ,headers); String result = restTemplate.getForObject(url, String.class);
闲话不多说,直接看代码
RestTemplate发起http请求中文乱码问题解决方案
标签:pen pre 中文乱码问题 ToJson ons temp dia headers form
原文地址:https://www.cnblogs.com/zjting/p/10980966.html