以前运行正常,突然有一天发现,POST提交的中文变为乱码。
页面编码为GBK. 接收页面,在最前面写有:request.setCharacterEncoding("GBK");
如果在用 String str = request.getParameter("str"); 取参数后
byte[] tempByte = str .getBytes("ISO8859_1");
str = new String(tempByte,"GBK");
可以获取到正常的中文编码。
网站没有用fliter,其实fliter 里也是这句话:request.setCharacterEncoding("GBK");,但好像这句没起作用。
服务器是linux,是否与服务器上某些配置有关?还是什么原因,谁能帮我解答?谢谢