Solution to Chinese garbled characters on webpages-I have wings 1. Solve Chinese problems on HTML pages: To make HTML pages support Chinese characters well, you must add the following code in the header of each HTML page:
...
...
2. Solve the Problem of Chinese Characters in JSP pages. To make JSP pages support Chinese characters well, add the following code in the header of each JSP page:
<% @ Page contentType = "text/html; charset = gb2312" language = "java" %>
3. Solve the Problem of Servlet response results in Chinese. To make the Servlet page support Chinese well, you must add the following code in the header of each Servlet page:
Response. setCharacterEncoding ("gb2312 ");
4. Solve the Chinese problem of page data transmission. In order to make Chinese data normally transmitted between pages (components), the best solution is to use the encoding filter. Configure an encoding filter in WEB. XML with the following content:
EncodingFilter
Org. springframework. web. filter. CharacterEncodingFilter
Encoding
Gb2312
EncodingFilter
/*
5. solve the Chinese problem in HTTP (get) Request: by default, IE browser sends a "ISO-8859-1" encoding format to send the request, if the HTTP get request Chinese parameters are garbled, you can encode and convert it, for example:
String param = request. getParameter ("param ");
Param = new String (param. getBytes ("ISO-8859-1", "GB2312 "));
You can also modify the Tomcat server. xml file to solve the problem:
...
URIEncoding = "GB2312"/> --> Add this
6. Solve the Chinese problem of MySQL database: Solve the Chinese problem of MySQL database mainly on the URL of the JDBC driver, for example:
Jdbc: mysql: // localhost/test? User = root & password = 123456 & useUnicode = true & characterEncoding = gb2312