Convert HTML codes to plain text
15,298
Solution 1
System.Web.HttpUtility.HtmlDecode("Col´gio");
Solution 2
Just for completion:
If you are using .NET 4.0+ you can also use WebUtility.HtmlDecode
Solution 3
SecurityElement securityElement = System.Security.SecurityElement.FromString("<test>H&M</test>");
string unescapedText = securityElement.Text;
Console.WriteLine(unescapedText); // Result: H&M
Author by
Bruno Cruz
Updated on June 16, 2022Comments
-
Bruno Cruz almost 2 years
I've a string for example like this:
Col´gio
How can I convert it to:
Colégio
Without having to do a replace for all the html codes