您的位置:首页 > Web前端 > HTML

HTML特殊转义字符列表

2012-03-12 16:10 411 查看
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(">", ">");
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: