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 

  • 相关阅读:
    1061 Dating (20 分)
    1112 Stucked Keyboard (20 分)
    1077 Kuchiguse (20 分)
    1065 A+B and C (64bit) (20 分)
    1046 Shortest Distance (20 分)
    1124 Raffle for Weibo Followers (20 分)
    1036 Boys vs Girls (25 分)
    1113 Integer Set Partition (25 分)
    f开头的
    g开头的
  • 原文地址:https://www.cnblogs.com/coolsundy/p/4263373.html
Copyright © 2011-2022 走看看