window.location.href 传中文乱码

xiaoxiao2021-02-28  84

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");

转载请注明原文地址: https://www.6miu.com/read-55803.html

最新回复(0)