<a href="result.jsp?page=<%=intPage+1%>&searchKey=<%=key%>">下一页</a>
当点击下一页之后:
转到:
key=new String(request.getParameter("searchKey").getBytes("ISO-8859-1"),"UTF-8");
得到的key是乱码
奇怪的是如果key值是一个词语,也就是两个字,不会有乱码,
但是如果key是一个中国字的话,就会出现乱码,也就是一个框框啦,不管我用System.out.println(new String(key.getBytes("ISO-8859-1"),"gb2312"));
System.out.println(new String(key.getBytes("UTF8"),"gb2312"));
System.out.println(new String(key.getBytes("GB2312"),"gb2312"));
System.out.println(new String(key.getBytes("GBK"),"gb2312"));
System.out.println(new String(key.getBytes("BIG5"),"gb2312"));
System.out.println(new String(key.getBytes("ISO-8859-1"),"UTF-8"));
System.out.println(new String(key.getBytes("UTF8"),"UTF-8"));
System.out.println(new String(key.getBytes("GB2312"),"UTF-8"));
System.out.println(new String(key.getBytes("GBK"),"UTF-8"));
System.out.println(new String(key.getBytes("BIG5"),"UTF-8"));
都打印不出原来的那一个字
用的是Eclipse+tomcat
把你的URL编码
按楼上的也行