I have a responseEntity
like this one:
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
requestHeaders.setContentType(MediaType.valueOf("text/plain;charset=UTF-8"));
HttpEntity requestEntity = new HttpEntity(jsonQuery, requestHeaders);
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
//Not in UTF-8!!
logger.debug("result: " + responseEntity.getBody());
But it's not encoded in UTF-8
and produces characters like this: Soci굩
. Is it possible to make it in UTF-8
or add the encoding somehow in restTemplate?
responseHeaders.add("Content-Type", "text/html; charset=utf-8");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With