HTML特殊编码转换

var encoded = ""'&<>¡¢£¤" +
              "¥¦§¨©ª«¬­®" +
              "¯°±²³´µ¶·" +
              "¸¹º»¼½¾¿" +
              "×÷ÀÁÂÃÄÅ" +
              "ÆÇÈÉÊËÌÍ" +
              "ÎÏÐÑÒÓÔÕ" +
              "ÖØÙÚÛÜÝÞ" +
              "ßàáâãäåæ" +
              "çèéêëìíî" +
              "ïðñòóôõö" +
              "øùúûüýþÿ";
var expected = "\"'&<>¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿×÷ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ" +
                "ÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ";

Console.WriteLine(System.Net.WebUtility.HtmlDecode(encoded) == expected);//解码

 

你可能感兴趣的:(HTML特殊编码转换)