一、客户端请求服务器的数据有乱码
1.get方式请求
①修改tomcat/conf/server.xml,在<Connector> 标签中添加属性useBodyEncodingForURI="true"
②在获取请求数据之前,设置 request.setCharacterEncoding("utf-8");
2.post方式请求
在获取请求数据之前,设置 request.setCharacterEncoding("utf-8");

二、服务器返回给客户端的数据有乱码
response.setContentType("text/html; charset=utf-8");

相关文章:

  • 2022-01-10
  • 2021-11-17
  • 2022-12-23
  • 2021-12-04
  • 2021-06-20
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2021-09-14
  • 2021-11-16
相关资源
相似解决方案