String value=request.getParameter(name);
value=new String(value.getBytes("iso8859-1"),"gb2312");
而用表单提交时是按utf-8编码的数据,然后服务器以iso8859-1接收,解决方案是:
String value=request.getParameter(name);
value=new String(value.getBytes("iso8859-1"),"utf-8");
String value=request.getParameter(name);
value=new String(value.getBytes("iso8859-1"),"gb2312");
而用表单提交时是按utf-8编码的数据,然后服务器以iso8859-1接收,解决方案是:
String value=request.getParameter(name);
value=new String(value.getBytes("iso8859-1"),"utf-8");