zoukankan      html  css  js  c++  java
  • js和C#中的编码和解码

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

    JS中的URL编码和解码。对 ASCII 字母和数字及以下特殊字符无效: - _ . ! ~ * ' ( ) ,/?:@&=+$#

    encodeURI("http://www.w3school.com") //url编码
    decodeURI("http%3A%2F%2Fwww.w3school.com.cn") //url解码

    encodeURIComponent("http://www.w3school.com") //url编码,含+
    decodeURIComponent("http%3A%2F%2Fwww.w3school.com.cn") //url解码,含+

    JS中的HTML编码和解码。对 ASCII 字母和数字及以下特殊字符无效: - _ . ! ~ * ' ( )

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

    C#中的URL编码和解码

    HttpUtility.UrlEncode("http://www.w3school.com") //url编码
    HttpUtility.UrlDecode("http%3A%2F%2Fwww.w3school.com.cn") //url解码

    C#中的HTML编码和解码

    HttpUtility.HtmlEncode("text") //html编码
    HttpUtility.HtmlDecode("text") //html解码
  • 相关阅读:
    第二题
    第一题
    biancheng
    用泰勒展开式计算sin
    矩阵求和
    1
    ti
    实验10
    实验9
    实验8
  • 原文地址:https://www.cnblogs.com/kandyvip/p/4142129.html
Copyright © 2011-2022 走看看