日期:2014-05-20  浏览次数:20803 次

Ajax的responseText返回乱码该如何解决?试过N种方法无效!求救!
服务器端:
response.setCharacterEncoding("UTF-8");
response.setHeader("Charset","UTF-8");
System.out.println(request.getCharacterEncoding());
System.out.println(response.getCharacterEncoding());
控制台打出:
UTF-8
ISO-8859-1
 
前台jsp页面:
<%@ page contentType="text/html; charset=UTF-8" language="java" isELIgnored="false" errorPage=""%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%response.setHeader("Charset","UTF-8");%>

responseText返回的就是乱码,response.setCharacterEncoding("UTF-8");response.setHeader("Charset","UTF-8");这2句话好像根本没有反应,为什么呢?请高手指点!感谢!

------解决方案--------------------
传byte[]不要传String``