PrintWriter输出到页面中呈现乱码现象解决方案

来源:互联网 发布:ubuntu查看gpu 编辑:程序博客网 时间:2024/06/05 15:42

一般情况只使用下面代码:

PrintWriter out = response.getWriter();out.print("爱死费崇政");

输出到页面上基本会呈现出乱码现象,解决方案如下:

PrintWriter out = response.getWriter();response.setCharacterEncoding("utf-8");       response.setContentType("text/html; charset=utf-8");out.print("爱死费崇政");
0 0
原创粉丝点击