I\'m using the Java Spring Resttemplate for getting a json via a get request. The JSON I\'m getting has instead of special character slike ü ö ä or ß some weird stuff. So I
I have solved this problem. I need to POST a string object in request body with UTF-8.
text/plain
httpHeaders.setContentType(new MediaType("text", "plain", StandardCharsets.UTF_8));
applicaton/json
httpHeaders.setContentType(new MediaType("applicaton", "json", StandardCharsets.UTF_8));
RestTemplate restTemplate = new RestTemplate();
ResponseEntity resposeEntity = null;
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(new MediaType("text", "plain", StandardCharsets.UTF_8));
HttpEntity httpEntity = new HttpEntity(stringContent, httpHeaders);
responseEntity = restTemplate.exchange(requestUrl, HttpMethod.POST, httpEntity, String.class);
if (HttpStatus.OK.equals(responseEntity.getStatusCode())) {
logger.debug("... success ... result: " + responseEntity.getBody());
}