javaweb之解决get请求或者post请求获取参数中文乱码的问题

post请求:

在获取参数之前设置request的缓冲区编码

request.setCharacterEncoding("UTF-8");

get请求:

username=new String(username.getBytes("ISO8859-1"),"UTF-8");

猜你喜欢

转载自blog.csdn.net/qq_41901915/article/details/86487373