`

window.location.href url含中文服务器收到乱码问题解决

 
阅读更多

 

window.location.href url含中文服务器收到乱码问题解决

(1).页面中先对中文进行编码。

如:window.location.href = url+"&groupName=" + encodeURI(encodeURI(groupName)) ;

注意,页面部分需要编码两次。

(2).在服务端进行解码。
  groupName= java.net.URLDecoder.decode(groupName, "UTF-8");

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics