有好几个地方:
1.JSP设置 contentType
2.Filter:utf8 request.setCharacterEncoding()
3.Tomcat server.xml:
<Connector useBodyEncodingForURI="true" />
也可URIEncoding="UTF-8"
http://tomcat.apache.org/tomcat-7.0-doc/config/http.html
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.
可以用此参数,指定在使用%XX 解码URL 之后,用来解码URI的字符集。如果未指定,ISO-8859-1被使用。 |
useBodyEncodingForURI | This specifies if the encoding specified in contentType should be used for URI query parameters, instead of using the URIEncoding.This setting is present for compatibility with Tomcat 4.1.x, where the encoding specified in the contentType, or explicitly set using Request.setCharacterEncoding method was also used for the parameters from the URL. The default value is
此参数指定: 是否 在 URI查询参数(相当于GET请求参数吧) 中使用 JSP页面的contentType 编码 , 而不是 使用上面 URIEncoding定 死 的那个编码。这个设置兼容Tomcat4.1.x,就是说,在contentType中指定的 编码字符集,或用request.setCharacterEncoding方法指定 的 编码字符集,同样也用于URL传来的参 数。默认是=false的。 |
暂时先就这么标注下,下班了,有时间好好整理下