『备注』&#x;格式 的编码转换

『备注』&#x;格式 的编码转换,第1张

『备注』&#x; 格式 的编码转换

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

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


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

 //各种 幺蛾子网页图标 请参见: https://dev.w3.org/html5/html-author/charref

             string str = "中国";
string str2 = "中国";
string str3 = "♣♣♣♣█"; string decode = System.Web.HttpUtility.HtmlDecode(str);
Console.WriteLine(decode); //中国
decode = System.Web.HttpUtility.HtmlDecode(str2);
Console.WriteLine(decode); //中国
decode = System.Web.HttpUtility.HtmlDecode(str3);
Console.WriteLine(decode); //♣♣♣♣█ //有些 ♣ 格式, 识别不了. Console.WriteLine(System.Web.HttpUtility.HtmlEncode("我爱中国")); //不会被再次转义为 � 格式

最后的废话:

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


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


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


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/587795.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-12
下一篇 2022-04-12

发表评论

登录后才能评论

评论列表(0条)

保存