1.保证JSP页面已经设置为utf-8;
2.
request.setCharacterEncoding("UTF-8")
response.setCharacterEncoding("UTF-8")
或是写一个字符过滤器,在web.xml中调用;
3.最为重要的tomcat配置
在tomcat安装目录下的conf/server.xml文件中
找到节
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
添加一个属性 useBodyEncodingForURI="true"
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
useBodyEncodingForURI="true"
redirectPort="8443" />
2.
request.setCharacterEncoding("UTF-8")
response.setCharacterEncoding("UTF-8")
或是写一个字符过滤器,在web.xml中调用;
3.最为重要的tomcat配置
在tomcat安装目录下的conf/server.xml文件中
找到节
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
添加一个属性 useBodyEncodingForURI="true"
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
useBodyEncodingForURI="true"
redirectPort="8443" />