js 中 url传中文乱码问题解决办法

 

jsp 页面中的JS代码:

function  removeFile(str){
	 var title = document.getElementById("title").value;
	 window.location.href="<%=request.getContextPath()%>/removeAnnualReport.do?   title="+encodeURI(encodeURI(title));
 }
注意:使用两次encodeURI 对title 进行转换

  

 

   java中转码:
   
		this.getRequest().setCharacterEncoding("UTF-8");
		title =URLDecoder.decode(title, "UTF-8");

使用URLDecoder 进行解码

 

经以上测试,成功。记录一下。

你可能感兴趣的:(jsp,IE)