当前位置: 代码迷 >> Java Web开发 >> js中encodeURIComponent转码后到后台老板直接输出 变成乱码
  详细解决方案

js中encodeURIComponent转码后到后台老板直接输出 变成乱码

热度:67   发布时间:2016-04-16 23:55:09.0
js中encodeURIComponent转码后到后台直接输出 变成乱码
前台用js的encodeURIComponent转码后,在前台输出一下 是%16进制码 但是到后台,也是直接输出,并没有再转码,但是却变成乱码,请问这是什么情况呢?

------解决方案--------------------

在JS中需要转码2次,在后台在解码
conditions=encodeURI(conditions);
conditions=encodeURI(conditions);//必须要转码2次