I have a use case where I send parameters to the spring controller via an email request. In the controller, I read the parameters and perform some actions. After that, I send these parameters as part of the request parameters to another URL.
Here I can not deal with Chinese characters. He becomes distorted.
The actions that I am doing now: 1) I go under the Chinese text as a parameter with the name of the topic from the HTML page (this is not JSP). 以下 便是 有关 此 问题 的 所有 信息
2) When I read this value from the request in the controller, it comes as: ä "¥ ä¸ä¾¿æ¯æå³æ¤é®é ¢ çææä¿¡æ¯
3) I can not get the exact value that is sent from the page.
It looks like it is already encoded when I check the encoded text below the url: http://coderstoolbox.net/string/#!encoding=none&action=encode&charset=utf_8 http://www.cafewebmaster.com/online_tools/utf_decode
4) Now I want to pass the actual string sent by the user to another URL as response.sendRedirect. I tried to decrypt the url to find out if I can get the actual string, but did not succeed.
I am using tomcat server. I defined UTF-8 encoding in server.xml and added URLEncodingFilter in web.xml as the first filter. This filter executes request.setEncoding for UTF-8.
However, I cannot keep track of where everything is going wrong. Can someone suggest me how to return the actual string to the controller?
Also there is a filter below in my web.xml
<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>
Let me know if you need any information to get more context.