【发布时间】:2010-11-25 22:47:47
【问题描述】:
我的 UTF-8 xml 元素中有一个“title”属性,例如
<tag title="This is some test with special chars §£" />
由于我希望将此属性的内容直接打印在 HTML 页面中,因此我尝试输出如下:
<tag title="This is some test with special chars §£" />
我在其中添加属性的代码片段如下所示:
new XElement( "tag",
new XAttribute( "title" , title)
);
& 和 " 等字符被转义,但 §£ 不是 - 因为它们是有效的 utf-8 字符。 我应该改变什么?
【问题讨论】:
标签: c# xml linq-to-xml