从tomcat8.0开始,URIEncoding默认值不再是ISO8859-1,而变成了UTF-8

来自http://mycloudream.github.io/2016/06/30/Servlet%E5%A4%84%E7%90%86get%E8%AF%B7%E6%B1%82%E6%97%B6%E7%9A%84%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E9%97%AE%E9%A2%98.html


官方文档 (https://tomcat.apache.org/tomcat-8.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, UTF-8 will be used unless the org.apache.catalina.STRICT_SERVLET_COMPLIANCE system property is set to true in which case ISO-8859-1 will be used.

那么也就意味着,从tomcat8.0开始,get请求中的中文参数,不需要特殊处理了。而如果是tomcat8之前的项目要迁移到tomcat8上面来,则也需要特殊注意这个问题,可能要删减代码中响应乱码的处理模块了。




猜你喜欢

转载自blog.csdn.net/xingchenzyx/article/details/78245549