zoukankan      html  css  js  c++  java
  • 『备注』&#x; 格式 的编码转换

    在很多 网站(或者很多 WebService),

    我们总能看到 Ӓ &#A22A;  这种格式 的编码。

    如何将这种编码 转换成 实际文本,C#代码如下:

     1 //各种 幺蛾子网页图标 请参见: https://dev.w3.org/html5/html-author/charref
     2 
     3             string str = "中国";
     4             string str2 = "中国";
     5             string str3 = "♣♣♣♣█";
     6 
     7 
     8             string decode = System.Web.HttpUtility.HtmlDecode(str);
     9             Console.WriteLine(decode);  //中国
    10             decode = System.Web.HttpUtility.HtmlDecode(str2);
    11             Console.WriteLine(decode);  //中国
    12             decode = System.Web.HttpUtility.HtmlDecode(str3);
    13             Console.WriteLine(decode);  //♣♣♣♣█    //有些 ♣ 格式, 识别不了.
    14 
    15             Console.WriteLine(System.Web.HttpUtility.HtmlEncode("我爱中国")); //不会被再次转义为 � 格式

    最后的废话:

    > ࢮ 这种编码 是 UTF8 网页编码时用到。

    > 这类编码 和   ≶ &tg; 这类编码 基本是 一伙的。

    > 但: ࢮ  这类编码 目测毫无价值。

  • 相关阅读:
    postgresql全文检索部署实施
    从一整数数组中找出只重复一次的两个数
    Edit Distance 最小编辑距离
    Vue:v-model指令在其他元素类型的使用
    Vue:v-model指令
    Vue:v-on指令
    Vue:v-bind指令
    Vue:v-for指令
    框架Django
    Vue的安装和语法
  • 原文地址:https://www.cnblogs.com/shuxiaolong/p/20170929_HttpUtility_HtmlDecode.html
Copyright © 2011-2022 走看看