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解码
  • 相关阅读:
    BTree和B+Tree详解
    python小技巧01递归解释内嵌
    Python实战171201筛选数据
    学术网站
    现代科技新闻
    人工智能——深度学习介绍
    时区缩写
    centos7忘记root密码
    centos7正确关机重启
    虚拟化漫谈
  • 原文地址:https://www.cnblogs.com/kandyvip/p/4142129.html
Copyright © 2011-2022 走看看