jsp的url传递中文参数乱码解决方案,linux测试可用

方法1:

url="xxx.jsp?id="+java.net.URLEncoder.encode("中文", "UTF-8") 在这里,我们要用java.net.URLEncoder.encode("中文", "UTF-8") 接收时,我们用 String inf=request.getParameter("id"); inf= new String(inf.getBytes("iso-8859-1"),"UTF-8");

方法2:

js var title = document.getElementById("title"); var url = "xxx.jsp?title="+encodeURI(title.value); jsp String title = new String(request.getParameter("qTitle").getBytes("iso-8859-1"),"UTF-8");

你可能感兴趣的:(jsp,linux,String,测试,url)