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

JS與C#編碼解碼

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

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

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

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

1.

JS: escape :

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

解碼使用:unescape

C#:

HttpUtility.UrlEncode 
HttpUtility.UrlDecode

2.

JS: encodeURI :

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

解碼使用decodeURI();

C#: decodeURIComponent

3.

JS: encodeURIComponent :

傳遞參數(shù)時(shí)需要使用encodeURIComponent,這樣組合的url才不會(huì)被#等特殊字符截?cái)唷?nbsp;                         

例如:<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)文章

最新評(píng)論