1.jsp传值后台乱码最好解决方案:
请使用<%@ page pageEncoding="UTF-8" %>页面编码
在<head></head>里加入<meta http-equiv="content-type" content="text/html; charset=utf-8" />
使用POST提交方式:
public
void
doFilter(..) {
req.setCharacterEncoding(
"UTF_8"
);
resp.setContentType(
"text/html; charset=UTF-8"
);
resp.setCharacterEncoding(
"UTF_8"
);
}
要保证过滤器处理编码逻辑在request获取第一个提参数之前(过滤器在最前面)
GET提交方式
请使用Javascript先encodeURI(encodeURI(url))处理一下在提交,后端java.net.URLDecoder获取
另外没事干不要修改Tomcat, URIEncoding
还有不要到处写new String(json.getBytes("ISO-8859-1"),"GBK"),
若上述方法解决不了:在参考一下网址
http://blog.csdn.net/beijiguangyong/article/details/7414247
http://blog.csdn.net/rugaxm/article/details/7804425
2.
1.JavaScript 传参乱码
2.JSP与页面参数传参乱码
3.链接传参乱码
4.数据库读取乱码
5.Java与文件/流之间的乱码
以上情况的解决方法: - http://www.cnblogs.com/loveis/articles/2030935.html