Chinese garbled problem

Using the sping4 framework to find Chinese garbled characters obtained by the get method of http when tomcat7 is running.

1. First configure the spring filter, the Chinese is still garbled after the visit

 <filter>

<filter-name>springUtf8Encoding</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>springUtf8Encoding</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

 

2. The  default input character set of tomcat is "iso8859-1", add URIEncoding="utf-8" useBodyEncodingForURI="utf-8" to <Connector /> in the configuration file server.xml of tomcat7  

The default input character set of tomcat is iso8859-1

as follows:

  <Connector connectionTimeout="20000" port="8080" 

    protocol="HTTP/1.1" redirectPort="8443" 

    URIEncoding="utf-8" useBodyEncodingForURI="utf-8" />

 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326924869&siteId=291194637