1.乱码原因返回的中文以ISO_8859_1编码返回,编码转换即可
new String(body.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
具体解决实例如下
RequestEntity<String> gh = RequestEntity.post(new URI("")).header("GH", "").body("");
ResponseEntity<String> exchange = restTemplate.exchange(gh, String.class);
String body = exchange.getBody();
String s = new String(body.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
另外乱码2情况,经过url编码的解码即可
URLDecoder.decode("", StandardCharsets.UTF_8.toString());