我无法解析json arabic test。我正在json发送请求
{"SUBJECT_AR":"أهلا بك"}
。但在 spring 中阅读此jsonobject
时,我收到?????
。发送请求时此jsonobject的内容类型为application/json;charset=utf-8
。我已将produces="application/json;charset=utf-8"
添加到其余控制器,即使它不起作用。
答案 0 :(得分:0)
在web.xml
(web-app
标记内)中添加以下代码,然后重试:
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>