Tomcat配置常见问题

请求乱码

需要在conf/server.xml中添加URIEncoding='UTF-8'

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

Tomcat请求回复体的缺省字符集编码是ISO-8859-1

官方字符编码介绍