RSS feed 字符的编码转换
我正在尝试在窗口中显示来自 CodePlex 项目的简单文本 RSS 提要。
我的问题是提要文本包含很多字符序列,如下所示:
:
-
etc..
我知道它们代表标点符号和一些特殊字符,具有某种编码,但我不知道如何将它们转换回简单的 ascii 字符...我的意思是,当然没有覆盖每个特殊字符的开关/外壳。
谢谢 !
总结:如何将 "My name is : Aurelien"
转换为 "My name is : Aurelien"
?
I am trying to show a simple text RSS feed from a CodePlex project in a window.
My problem is that the feed text contains a lot of character sequences that looks like:
:
-
etc..
I know that they represent the punctuation and some special chars, with some kind of encoding, but I do not know how I can convert them back to simple ascii chars... I mean, without a switch/case covering each special char of course.
Thank you !
Sum-up: How can I convert "My name is : Aurelien"
to "My name is : Aurelien"
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您通过标记生成的问题所看到的,这些是 HTML 编码的字符。
解码它们所需要做的就是使用
HttpUtility.HtmlDecode()
来解码它们。如果您使用的是 .NET 4.0,还可以使用
System.Net.WebUtility.HtmlDecode()
这将允许您继续针对客户端配置文件而不是完整的框架。As you can see by the question generated by your markup, those are HTML encoded characters.
All you have to do to decode them is use
HttpUtility.HtmlDecode()
to decode them.If you're using .NET 4.0, you could also use
System.Net.WebUtility.HtmlDecode()
which would allow you to continue to target the Client Profile rather than the full framework.