Spring RestTemplate Charset UTF-8 不起作用 [英] Spring RestTemplate Charset UTF-8 does not work
本文介绍了Spring RestTemplate Charset UTF-8 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为 Multipart/form-data resttemplate 请求设置 UTF-8
字符集.但它不起作用.我在这里阅读了很多答案,但在 Rest 服务端我只有 ???
.
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.
我的服务器端RestController
.在这里我只得到问号而不是 UTF-8
文本:
My Server Side RestController
. Here I get only question marks instead of UTF-8
text:
我的客户端RestTemplate
代码.这里表单文本以 UTF-8
正确显示:
My Client side RestTemplate
code. Here form text is displayed correctly in UTF-8
:
附注.当我使用 Postman
作为 Rest Client 时,文本以 UTF-8
PS. When I use Postman
as a Rest Client, the text is displayed in UTF-8
推荐答案
您是否尝试过编码?
map.add("message",URLEncoder.encode(emailForm.getEmailContent(), "UTF-8"));
这篇关于Spring RestTemplate Charset UTF-8 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文