AJAX GET请求中文乱码处理方案整合
- 设置过滤器编码为utf-8
tomcat -> conf -> server.xml文件
uriEncoding="UTF-8"
- 如果过滤器编码为其他编码格式,比如GBK,那么在程序中必须进行转码
name = new String(name.getBytes("GBK"),"utf-8");
- 如果没有设置过滤器编码,那么在程序中可以通过两种形式进行转码
name = new String(name.getBytes("iso-8859-1"),"utf-8");

浙公网安备 33010602011771号