1.jsp页面设置页头
<%@ page contentType="text/html; charset=gb2312" %>
2.ajax提交到后台时,用get/post都无所谓,也不需要编码
3.后台得到string时
s=new String(s.getBytes("ISO8859-1"),"GBK");
这样即可在后台得到正确的中文
4.从后台往页面传递内容如果有中文,则只需设置编码
response.setCharacterEncoding("GB2312");
1.jsp页面设置页头
<%@ page contentType="text/html; charset=gb2312" %>
2.ajax提交到后台时,用get/post都无所谓,也不需要编码
3.后台得到string时
s=new String(s.getBytes("ISO8859-1"),"GBK");
这样即可在后台得到正确的中文
4.从后台往页面传递内容如果有中文,则只需设置编码
response.setCharacterEncoding("GB2312");