码迷,mamicode.com
首页 > Windows程序 > 详细

js和C#中的编码和解码

时间:2014-12-04 11:41:52      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   sp   strong   on   div   log   

同一个字符串,用URL编码和HTML编码,结果是完全不同的。

JS中的URL编码和解码

encodeURIComponent("text") //url编码
decodeURIComponent("text") //url解码

JS中的HTML编码和解码

escape("text") //html编码
unescape("text") //html解码

 

C#中的URL编码和解码

 

HttpUtility.UrlDecode("text") //url编码
HttpUtility.UrlEncode("text") //url解码

 

 

C#中的HTML编码和解码

HttpUtility.HtmlDecode("text") //html编码
HttpUtility.HtmlEncode("text") //html解码

 

注意:不会被以上方法编码的字符:! * ( ) ‘

 

js和C#中的编码和解码

标签:style   blog   http   color   sp   strong   on   div   log   

原文地址:http://www.cnblogs.com/kandyvip/p/4142129.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!