There are many
(1) Find My. ini in the MySQL directory
Open it, find the default-character-Set setting, and change it:
Default-character-set = gb2312
If the version is 5.0 or later, you can set it in the configuration panel:
For details, see:Http://ycoe.cnblogs.com/articles/354485.html
(2) string newname = new string (name. getbytes ("iso-8859-1"), "GBK ");
1. Make sure that the character set you used when installing MySQL is GBK.
------> 1. <% @ page Language = "Java" pageencoding = "UTF-8" %>
------> 2. If you have a Chinese character in JSP, it can be displayed normally, and a form with a struts label can also be displayed as Chinese, however, when you submit Chinese characters in the form, it turns into garbled characters.
------> 3. After it turns into garbled characters, an error will occur when comparing the data with the database, and you will see ????? Garbled
------> 4. The solution is to delete <% @ page Language = "Java" pageencoding = "UTF-8" %> from the first line
<% @ Page contenttype = "text/html; charset = gb2312" %>
And
<Head> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/> (Note that the first line must be in the head)
------> 5. When using post to submit data, it will also become garbled. The solution is
Put the WEB-INF/Web. xml under the project file
Add the followingCode
<Filter>
<Filter-Name> set character encoding </filter-Name>
<Filter-class> filters. setcharacterencodingfilter </filter-class>
<Init-param>
<Param-Name> encoding </param-Name>
<Param-value> GBK </param-value>
</Init-param>
</Filter>
<Filter-mapping>
<Filter-Name> set character encoding </filter-Name>
<URL-pattern>/* </url-pattern>
</Filter-mapping>
Then copy the WEB-INF/classes/filter directory in the servlet to the corresponding directory in the project, so as to solve the problem caused by post submission.
OK! Change to struts Chinese
Servlet Chinese problems
Response. setcontenttype ("text/html; charset = gb2312 ");
Request. setcharacterencoding ("gb2312 ");
Struts Chinese problems
Compile the resource file with native2ascii.exe and place it in the original location.