I need to send some request parameters from browser to Spring MVC controller and process them later like method parameters. The problem is that tomcat I guess didn't put right encoding for URI data which passing through. Instead of 'Имя'
I'm having: %D0%9C%D0%91%D0%94%D0%9E%D0%A3+%D0%B4%2F%D1%81%E2%84%969%D1%81.+%D0%95%D0%BB%D0%B8%D0%BE%D0%BD%D0%BA%D0%B0
I use to read about this type of problem which occurs because of tomcat does not have URI encoding preinstalled.
If you mind do I have body encoding in tomcat config web.xml, so Yes I have:
<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>tru?</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
So I'm curious do I have to set up anything else to container config.? Thank you
You have to set the URIEncoding attribute for the HTTP connector in
server.xml
file inside your tomcat config dir:Only certain way I found to do this without changing Tomcat configuration is:
put parameter in form
and then encode it before submitting to server
now on server you will get correct string.