欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS與C#編碼解碼

 更新時間:2013年12月03日 10:33:52   作者:  
這篇文章主要是對JS與C#編碼解碼進行了詳細的介紹,需要的朋友可以過來參考下,希望對大家有所幫助

escape不編碼字符有69個:*,+,-,.,/,@,_,0-9,a-z,A-Z

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

encodeURIComponent不編碼字符有71個:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z

1.

JS: escape :

    js使用數(shù)據(jù)時可以使用escape
    例如:搜藏中history紀錄。
    0-255以外的unicode值進行編碼時輸出%u****格式,其它情況下escape,encodeURI,encodeURIComponent編碼結(jié)果相同。

解碼使用:unescape

C#:

HttpUtility.UrlEncode 
HttpUtility.UrlDecode

2.

JS: encodeURI :

    進行url跳轉(zhuǎn)時可以整體使用encodeURI
    例如:Location.href=encodeURI("http://cang.baidu.com/do/s?word=百度&ct=21");

解碼使用decodeURI();

C#: decodeURIComponent

3.

JS: encodeURIComponent :

傳遞參數(shù)時需要使用encodeURIComponent,這樣組合的url才不會被#等特殊字符截斷。                          

例如:<script language="javascript">document.write('<a href="http://passport.baidu.com/?logout&aid=7&

u='+encodeURIComponent("http://cang.baidu.com/bruce42")+'">退出</a& gt;');</script>

解碼使用decodeURIComponent()

C#:

[HttpContext.Current.]Server.UrlDecode

[HttpContext.Current.]Server.UrlEncode

相關(guān)文章

最新評論