HTML special escape characters
most commonly used character entities
Character Entities
Display Description entity name entity number
and a half square large blank & ensp; & # 8194;
all parties large blank & emsp; & # 8195;
whitespace & nbsp continue to row; & # 160;
<less than & lt; & # 60;
> greater than & gt; & # 62 is;
& & symbol & amp; & # 38 is;
"double quotation marks & quot; & # 34 is;
? Rights & Copy; & # 169;
? is a registered trademark & reg; & # 174;
?? trademark (USA) & # 8482;
× multiplication sign Times &; & # 215;
÷ Divide & divide; & # 247;
/// <summary>
/// Replaces the < with the less then symbol and > with the greater then symbol.
/// </summary>
/// <param name="xml">String to be unescaped</param>
/// <returns>An xml string containing the greter then and less then symbols.</returns>
private string UnEscapeXml(string xml)
{
string result = xml.Replace("<", "<");
result = result.Replace(">", ">");
result = result.Replace("'<'", "<");
result = result.Replace("'quot'", """);
return result.Replace("'>'", ">");
}
/// <summary>
/// Replaces the less then and greater then symbol with < and >
/// </summary>
/// <param name="xml">String to be escaped</param>
/// <returns>An xml string with < and ></returns>
private string EscapeXml(string xml)
{
string result = xml.Replace("<", "'<'");
result = result.Replace(""", "'quot'");
result = result.Replace(">", "'>'");
result = result.Replace("<", "<");
return result.Replace(">", ">");
}
Reproduced in: https: //www.cnblogs.com/zhangchenliang/archive/2012/03/12/2391961.html