zoukankan      html  css  js  c++  java
  • flex的http URL转码与解码

    private function httpEncoding(param:String):String{    //转码 
        return encodeURIComponent(param); 


    private function openSelfStr(deleteStr:String):String{    //解码 
        return decodeURIComponent(deleteStr); 





    ------------------------------------------------------------------------------------------------------- 
    在URL后面加?传递的参数里有中文的时候,后台就取不到值。这时就需要对其进行转码 

    Flex中转码的函数:escape,encodeURI,encodeURIComponent 

    Flex中相应解码函数:unescape,decodeURI,decodeURIComponent 



    一、escape对0-255以外的unicode值进行编码时输出%u****格式。 

    其它情况下escape,encodeURI,encodeURIComponent编码结果相同。 


    二、encodeURIComponent是将中文、韩文等特殊字符转换成utf-8格式的url编码,所以如果给后台传递参数需要使用encodeURIComponent时需要后台解码对utf-8支持 


    PS: 
    escape不编码字符有69个:*,+,-,.,/,@,_,0-9,a-z,A-Z 

    encodeURI不编码字符有82个:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z 

    encodeURIComponent不编码字符有71个:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z 

  • 相关阅读:
    Linux用户行为日志审计
    日志分析-Web
    secedit.exe 本地审核
    StreamCQL
    一个关于缓存很好的文章~
    Java免费开源数据库、Java嵌入式数据库、Java内存数据库
    MySQL db优化
    威胁情报
    《javascript设计模式》读书笔记二(封装和隐藏信息)
    Mysql触发器
  • 原文地址:https://www.cnblogs.com/coolsundy/p/4263373.html
Copyright © 2011-2022 走看看