在测试ajax的时候,遇到编码问题,出现在一些乱码。前面写的是escape(yourstring),在提交的jsp页面中用request.getParameter("")方法来取得,结果出现异常,没有办法。
解决办法:去掉前面escape,然后在jsp进行解码,再重新编码。
String author=new String(request.getParameter("author").getBytes("iso-8859-1"),"utf-8");
在测试ajax的时候,遇到编码问题,出现在一些乱码。前面写的是escape(yourstring),在提交的jsp页面中用request.getParameter("")方法来取得,结果出现异常,没有办法。
解决办法:去掉前面escape,然后在jsp进行解码,再重新编码。
String author=new String(request.getParameter("author").getBytes("iso-8859-1"),"utf-8");