首页 > 其他 > 详细

servelt乱码问题(tomcat服务端编码为ISO-8859-1)

时间:2017-01-09 21:32:57      阅读:547      评论:0      收藏:0      [点我收藏+]


Post的编码决定机制:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

A:request.setCharacterEncoding("服务端的编码")__硬编码

B:重新构建新的编码。____软编码
username = new String(username.getBytes("ISO-8859-1"),"GBK");

C:过滤器[推荐]

GET的编码。
硬编码不起任何作用!!!
(1):表单的GET
A:username = new String(username.getBytes("ISO-8859-1"),"GBK");

B:server.xml中配置URIEncoding="GBK"[推荐]

(2):链接的GET。

A:username = new String(username.getBytes("ISO-8859-1"),"GBK");

B:server.xml中配置URIEncoding="GBK"[推荐]

servelt乱码问题(tomcat服务端编码为ISO-8859-1)

原文:http://www.cnblogs.com/ziq711/p/6266457.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!