0bj3ct 0bj3ct - 2 months ago 28
reST (reStructuredText) Question

Spring RestTemplate Charset UTF-8 does not work

I want to set

UTF-8
charset for Multipart/form-data resttemplate request. But It does not work. I read a lot of answers here, but I got only
???
in Rest service side.

My Server Side
RestController
. Here I get only question marks instead of
UTF-8
text:

enter image description here

My Client side
RestTemplate
code. Here form text is displayed correctly in
UTF-8
:

enter image description here

PS. When I use
Postman
as a Rest Client, the text is displayed in
UTF-8

Answer

Have you tried encoding?

map.add("message",URLEncoder.encode(emailForm.getEmailContent(), "UTF-8"));
Comments