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


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"[推荐]

posted on 2017-01-09 20:29  ziq711  阅读(305)  评论(0编辑  收藏  举报