[LayaAirIDE 2.0]Laya.Utils.getQueryString 中文乱码

Laya.Utils.getQueryString 中文乱码
调用该方法 获取url参数中的中文乱码如下:
如来 变成了 å¦‚来
哪位大神知道原因?
已邀请:

Armed Panda

赞同来自:

自己回答了 Laya.Utils.getQueryString 方法的返回值是经过 unescape 解码的数值
我在 launch.json 中"file" 属性中加入了 中文参数如下
"file": "${workspaceRoot}/bin/index.html?mode=1&roomId=1&userName=如来&uid=1&headImg=weiguang/usericon/1.png.jpg&posId=0",
没有经过 escape 编码所以出来是乱码  å¦‚来
用 
console.log(escape("如来")); 方法先编码 然后把编码后的字符串 替换连接参数中的中文 如来 就可以了 如下
"file": "${workspaceRoot}/bin/index.html?mode=1&roomId=1&userName=%u5982%u6765&uid=1&headImg=weiguang/usericon/1.png.jpg&posId=0",
 

要回复问题请先

商务合作
商务合作