How can I tell RestTemplate to POST with UTF-8 encoding?

You need to add StringHttpMessageConverter to rest template’s message converter with charset UTF-8. Like this

RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters()
        .add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));

Leave a Comment