我今天也遇到这个错,什么原因?ssh框架,在action中
public String test() throws Exception{
ServletActionContext.getResponse().setCharacterEncoding("utf-8");
ServletActionContext.getResponse().getWriter().print("美国");
return NONE;
}
public String test1() throws Exception{
ServletActionContext.getResponse().setCharacterEncoding("GBK");
ServletActionContext.getResponse().getWriter().print("中国");
return NONE;
}
其他配置文件都是utf8,上面测试utf8美国乱码,gbk中国没有乱码
------解决方案--------------------
肯定还有哪一环编码没统一!server.xml是否改了!