<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> </filter> <filter-mapping> <filter-name>encodingfilter</ filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Above is the string encoding filter for SPRINGMVC, but the Chinese in the GET request is the same as the egg.
The GET request default encoding format is iso8859-1, so it's OK to convert it to utf-8.
You can transcode the Chinese string in the code you request to process it:
string param = new String (Param.getbytes ("iso8859-1"), "UTF-8");
But this approach is not elegant enough, every Chinese get request you have to transcode. Fortunately, I found a better way to add the configuration uriencoding= "UTF-8" to the Tomcat service profile Server.xml:
<connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443" URIEncoding= " UTF-8 "/>
Springmvc character encoding filter for Chinese GET request garbled problem resolution method