eclipse代码发布到服务器(Tomcat)出现乱码现象解决方法

我们只需写两行代码就可以解决问题了

//设置response查询的码表
  response.setCharacterEncoding(“UTF-8”);
  //通过一个头Content - Type 告知客户端使用何种码表
  response.setHeader(“Content-Type”, “text/html;charset=UTF-8”);
  response.getWriter().write(“中国!!!”);

猜你喜欢

转载自blog.csdn.net/qq_41683305/article/details/88580809