C# HtmlEncode - ISO-8859-1 Entity Names vs Numbers

后端 未结 5 1341
名媛妹妹
名媛妹妹 2020-12-10 13:36

According to the following table for the ISO-8859-1 standard, there seems to be an entity name and an entity number associated with each reserved HTML character.

So

5条回答
  •  星月不相逢
    2020-12-10 14:23

    I made this function, I think it will help

            string BasHtmlEncode(string x)
            {
               StringBuilder sb = new StringBuilder();
               foreach (char c in x.ToCharArray())
                   sb.Append(String.Format("&#{0};", Convert.ToInt16(c)));
               return(sb.ToString());
            }
    

提交回复
热议问题