我该如何去code的HTML字符在C#? [英] How can I decode HTML characters in C#?

查看:86
本文介绍了我该如何去code的HTML字符在C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的电子邮件地址带HTML字符实体codeD。有没有在.NET中任何可以将它们转换为纯字符串?

I have email addresses encoded with HTML character entities. Is there anything in .NET that can convert them to plain strings?

推荐答案

您可以使用<一个href=\"http://msdn.microsoft.com/en-us/library/7c5fyk1k.aspx\"><$c$c>HttpUtility.HtmlDe$c$c

如果您使用的是.NET 4.0+你也可以使用 WebUtility.HtmlDe code 它,因为它是在 System.Net 命名空间中可用,不需要额外的程序集引用。

If you are using .NET 4.0+ you can also use WebUtility.HtmlDecode which does not require an extra assembly reference as it is available in the System.Net namespace.

这篇关于我该如何去code的HTML字符在C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆