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 JS: escape : js使用数据时可以使用escape 解码使用:unescape C#: HttpUtility.UrlEncode 2. JS: encodeURI : 进行url跳转时可以整体使用encodeURI 解码使用decodeURI(); C#: decodeURIComponent 3. JS: encodeURIComponent : 传递参数时需要使用encodeURIComponent,这样组合的url才不会被#等特殊字符截断。 解码使用decodeURIComponent() C#: [HttpContext.Current.]Server.UrlDecode [HttpContext.Current.]Server.UrlEncode (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |