<HEAD>html
...java
<META http-equiv=Content-Type content="text/html;charset=utf-8">mysql
...web
<HEAD>spring
<%@ page contentType="text/html;charset=gb2312" language="Java"%>sql
response.setCharacterEncoding("gb2312");數據庫
<!--定義編碼過濾器-->瀏覽器
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>app
<init-param>ui
<param-name>encoding</param-name>
<param-value>gb2312</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
String param = request.getParameter("param");
param = new String(param.getBytes("ISO-8859-1", "GB2312"));
也能夠經過修改Tomcat的server.xml文件來解決:
<Connector port = "8080"
...
URIEncoding="GB2312"/> -->增長這項
jdbc:MySQL://localhost/test?user=root&password=123456&useUnicode=true&characterEncoding=gb2312
頂