Post方式乱码:request.setCharacterEncoding(“utf-8”);
GET方式:
1.修改tomcat解码字符集 conf/server.xml URIEndoing=”utf-8”
2.手动重新编码
username = URLEncoder.encode(username, “ISO-8859-1”);
username = URLDecoder.decode(username,”utf-8”);
简化:
username = new String(username.getBytes(“ISO-8859-1”), “utf-8”);
时间: 2024-11-06 21:36:47