1. First set the workspace and file encoding format in the development tool eclipse, see http://www.cnblogs.com/lixiang1993/p/7345161.html
2. In the installation root of Eclipse, open the Eclipse.ini file and add "-dfile.encoding=utf-8" to the last line of the file so that the files created in eclipse are saved with Utf-8 encoding.
3, the request garbled problem
(1) solve the GET request garbled problem: In the Tomcat root directory, enter the Conf folder, open Server.xml file, search connector, add attribute uriencoding, attribute value is UTF-8,
Note: There are multiple connector in the file, note the selection.
(2) solve the problem of POST request garbled
① before receiving the parameter, encode it,
Request.setcharacterencoding ("Utf-8");
②SSM frame, add post garbled filter
<!--Post garbled filter - <Filter> <Filter-name>Characterencodingfilter</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>Characterencodingfilter</Filter-name> <Url-pattern>/*</Url-pattern> </filter-mapping>
4, Response garbled problem
Before passing the parameter, encode it,
Response.setcontenttype ("Text/html;charset=utf-8");
Chinese garbled problem (page garbled, Eclipse garbled, request response garbled)