HTTP请求有get和post,这两中方式解决中文乱码的方式如下:

1.Post方式请求

//这句话是设置post请求体的编码为utf-8
request.setCharacterEncoding("utf-8");
//获取请求参数 request.getParameter(
"username");

2.Get方式请求

new String(request.getParameter("username").getBytes("ISO-8859-1"),"utf-8");

HttpServletRequest解决中文乱码的问题

相关文章:

  • 2021-11-28
  • 2021-08-08
  • 2021-04-21
  • 2021-10-14
  • 2021-11-28
  • 2021-08-08
  • 2021-07-04
猜你喜欢
  • 2022-12-23
  • 2022-01-15
  • 2021-07-28
  • 2021-10-09
  • 2021-12-15
相关资源
相似解决方案