HTML特殊逸出字元列表
最常用的字元實體
Character Entities
顯示 說明 實體名稱 實體編號
半方大的空白    
全方大的空白    
不斷行的空白欄框  
< 小於 < <
> 大於 > >
& &符號 & &
" 雙引號 " "
? 著作權 © ©
? 登入商標 ® ®
? 商標(美國) ? ™
× 乘號 × ×
÷ 除號 ÷ ÷
/// <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(">", ">");
}