GET提交参数乱码问题(apache-tomcat-9.0.0.M19)
来源:互联网 发布:淘宝男模特排名与图片 编辑:程序博客网 时间:2024/05/16 09:36
我用的IDE是myeclipse 2017 ci3 服务器为apache-tomcat-9.0.0.M19
// 在过滤器中判断如果是get提交并转码
if ("GET".equals(methoSubmit)) {
if (value != null && !"".equals(value.trim())) {
//tomcat服务器配置文件server.xml 中没有设置URIEncoding,
value = new String(value.getBytes("ISO-8859-1"), "utf-8"); //转换后就乱码,不转换正常
}
}
百度了很多文章都说tomcat服务器配置文件server.xml 中没有设置URIEncoding,默认为ISO-8859-1。
但如果是这样的话应该是转码后不会乱码才对。后来实在想不出问题出在哪。去官网查了官方文档。在官方文档的FAQ/CharacterEncoding
得到答案。原来tomcat8.0服务器起默认URIEncoding为utf-8编码。
下面部分对于GET提交参数的解释
How do I change how GET parameters are interpreted?
Tomcat will use ISO-8859-1 as the default character encoding of the entire URL, including the query string ("GET parameters") (though see Tomcat 8 notice below).
There are two ways to specify how GET parameters are interpreted:
Set the URIEncoding attribute on the <Connector> element in server.xml to something specific (e.g. URIEncoding="UTF-8").
Set the useBodyEncodingForURI attribute on the <Connector> element in server.xml to true. This will cause the Connector to use the request body's encoding for GET parameters.
In Tomcat 8 starting with 8.0.0 (8.0.0-RC3, to be specific), the default value of URIEncoding attribute on the <Connector> element depends on "strict servlet compliance" setting. The default value (strict compliance is off) of URIEncoding is now UTF-8. If "strict servlet compliance" is enabled, the default value is ISO-8859-1.
百
- GET提交参数乱码问题(apache-tomcat-9.0.0.M19)
- tomcat get提交乱码
- tomcat中页面利用get方式提交的参数中的中文乱码问题
- tomcat编码格式的设置/如何解决get()方式提交中文参数乱码的问题
- tomcat url get 中文参数乱码问题
- get提交乱码问题
- tomcat 8解决了GET提交的中文乱码问题
- 利用tomcat解决get提交中文乱码问题
- ajax GET方式提交,中文参数乱码的问题
- 解决ajax get方式提交中文参数乱码问题
- get请求tomcat不同版本,参数乱码问题
- JSP中URL中文乱码问题!get提交时,服务器端乱码,url带中文参数乱码
- 表单get提交乱码问题
- get提交中文乱码问题
- apache+tomcat 乱码问题
- Tomcat修改get提交请求乱码
- get提交乱码 post提交乱码 java乱码问题
- ajax get提交中文参数乱码
- 关于概率和 统计的复习、思考
- 文法分析的三种符号集
- 虚拟机3种网络模式(桥接、nat、Host-only)
- jQuery
- [bigdata-66] ubuntu 14.04 + keepalived+mysql5.5 mysql双机主主同步热备ip漂移故障自动切换实践
- GET提交参数乱码问题(apache-tomcat-9.0.0.M19)
- Linux信号3
- 原生JS Ajax操作
- Mac OS X 安装 Nginx
- ubuntu如何修改terminal终端的主机名
- Emgucv类型转换
- 白羽的终点
- JAVA 并发编程一
- GDB