tomcat中文乱码

tomcat 默认的编ISO-8859-1编码,部分中文会出现乱码

URIEncoding
This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, ISO-8859-1 will be used.

编码设置

conf/server.xml

修改前:

1
<Connector port="8080" redirectPort="8443" connectionTimeout="20000" protocol="HTTP/1.1"/>

修改后:

1
2
3
<Connector port="8080" redirectPort="8443" connectionTimeout="20000" 
protocol="HTTP/1.1"
URIEncoding="UTF-8"/>

参考

  1. The HTTP Connector