Tomcat sets URI default character set as UTF-8, uriutf-8
When a new Spring MVC project is configured, garbled characters are found in the Chinese parameters of the Get request:
View the encoding configuration in SpingMVC (in web. xml), as shown below:
<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> <servlet-name>appkit</servlet-name> </filter-mapping>
It should not be the problem of Spring, it should be the problem of Tomcat, and then modify the Tomcat configuration file server. xml, add URIEncoding = "UTF-8"
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>
Then you can just