js和C#中的编码和解码(备忘)

同一个字符串,用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解码
原文地址:https://www.cnblogs.com/ajunForNet/p/4145278.html