jquery 跳转页面参数中文 URI malformed 错误处理

一,使用 escape() 编码的字符串

url加密传参有时候会出现Uncaught URIError: URI malformed的错误,这是因为你的url中包含了“%”字符,浏览器在对“%”执行decodeURIComponent时报错,正确的解决是将%全部替换为%25再进行传输

url: '/xxx/yyy?key=' + key + "&Account=" + escape(Account) + '&RealName=' + escape(RealName).replace(/%/g,'%25')

二,js 接收参数 使用 unescape() 对 escape() 编码的字符串进行解码

unescape(request('RealName'))