Reference: http://www.cr173.com/html/26783_1.html
1. Coding format for programming tools
The default encoding for new items in Eclipse is GBK, which modifies the default encoding format, which is only valid for the current workspace
Select the text tree, click Open, select Java Source file, enter UTF-8 in the default encoding input box below, press the Update button, then set the Java file encoding to UTF-8
(Note: Java application Development related files such as: properties, XML, etc. have been specified by the Eclipse default, respectively, Iso8859-1,utf-8, such as the development of the need to change the encoding format can also be specified here.) )
Of course I usually directly select text to set.
2. Encoding format in the project
Set the encoding format in the project, in Web. xml
<!--character encoding filters--
<filter>
<filter-name>code</filter-name>
<filter-class>com.bear.filter.CodeFilter</filter-class>
<init-param>
<param-name>encode</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>code</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Encoding format in 3.tomcat
Modify the Server.xml file
<connector uriencoding= "UTF-8" connectiontimeout= "20000" port= "8080" protocol= "http/1.1" redirectport= "8443"/ >
Eclipse Encoding Format settings