国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

JS與C#編碼解碼

2019-11-14 13:41:00
字體:
來源:轉載
供稿:網友

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使用數據時可以使用escape
    例如:搜藏中history紀錄。
    0-255以外的unicode值進行編碼時輸出%u****格式,其它情況下escape,encodeURI,encodeURIComponent編碼結果相同。

解碼使用:unescape

C#:

HttpUtility.UrlEncode  
HttpUtility.UrlDecode

2.

JS: encodeURI :

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

解碼使用decodeURI();

C#: decodeURIComponent

3.

JS: encodeURIComponent :

傳遞參數時需要使用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

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大洼县| 边坝县| 阳西县| 连城县| 金堂县| 富阳市| 芮城县| 增城市| 元氏县| 金阳县| 舒城县| 贵定县| 高淳县| 明光市| 亳州市| 正镶白旗| 祁阳县| 沐川县| 旬阳县| 来凤县| 郧西县| 建瓯市| 环江| 瑞金市| 阜新| 伊宁市| 肥西县| 阳原县| 嘉善县| 洪江市| 常州市| 蛟河市| 长葛市| 邵武市| 金塔县| 乐安县| 定陶县| 龙南县| 方城县| 绵竹市| 宜宾市|