Reputation: 3447
My question is simple. I searched a little online, but could not find a quick way to unescape HTML text in a string.
For example:
"< > &"
should be returned to "< > &" as a string.
Is there a quick way, or do I have to write my own unescaper?
Upvotes: 8
Views: 17581
Reputation: 1379
HttpUtility.UrlDecode("Your escaped String", System.Text.Encoding.Default);
Upvotes: 2
Reputation: 646
If you're using .NET 4.5 then you can use the HttpUtility.HtmlDecode
method.
Upvotes: 1
Reputation: 35353
use System.Web.HttpUtility.HtmlDecode
or System.Net.WebUtility.HtmlDecode
var decoded = HttpUtility.HtmlDecode("< > &");
Upvotes: 14