Get Post乱码
程序员文章站
2022-07-08 16:01:45
...
get乱码
方法1(麻烦): new String(name.getBytes("iso8859-1"),"utf-8");
方法2: 在server.xml中增加URIEncoding="UTF-8"
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"/>
post乱码
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");