使用jFreeChart产生图片,从后台输出到JSP时,导致JSP页面的其它地方汉字出现乱码,在JSP除了加入几种编码设置,如:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %>
外,在后台需要将PrintWriter的字符也设置,本人处理代码:
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("text/html; charset=UTF-8");
PrintWriter printwriter = response.getWriter();
转载于:https://blog.51cto.com/1161384/1180363