BASE64  通过url传递到后台 加号变空格的处理方法

解决方法:

 前台处理:str.replace("+", "%2B"); (错误)

     

<script>
var s = "LOVE LIFE ! LOVE JAVA ...";
alert(s);
alert(s.replace("LOVE ", "爱"));
alert(s.replace(/\LOVE/g, "爱"));
</script>

    

前台处理 :Java方法:URLEncoder.encode(str,"UTF-8");js 方法encodeURIComponent(str);

后台处理:URLDecoder.decode(str,"UTF-8");

 

原理 参考:http://blog.csdn.NET/wang0928007/article/details/7429568

          http://tech.sina.com.cn/s/2008-07-07/1053722241.shtml

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-15
  • 2021-09-22
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2022-02-21
  • 2023-03-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案