标签:style color io ar java strong sp 问题 on
window.location="Test.jsp?param1="+encodeURI(encodeURI(str));//对中文参数进行双层编码后再传递
URLDecoder.decode(request.getParameter("param1"),"utf-8");//对中文参数进行解码
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
url="xxx.jsp?id="+java.net.URLEncoder.encode("中文", "UTF-8") //加码
接收时,我们用
String inf=request.getParameter("id");
inf= new String(inf.getBytes("iso-8859-1"),"UTF-8"); 解码
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
标签:style color io ar java strong sp 问题 on
原文地址:http://www.cnblogs.com/yy123/p/4014985.html