John K
John K

Reputation: 28869

FCL utility to convert XML named entities to numeric equivalents?

Of the FCL classes (or even using an external API) is there a utility assembly, class or members that can be plugged into a .NET application to convert all named entities to their numeric equivalents?

For example, É would become É.

Upvotes: 0

Views: 162

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038830

You may take a look at the HtmlDecode and HtmlEncode methods:

class Program
{
    static void Main()
    {
        var s = HttpUtility.HtmlDecode("É");
        s = HttpUtility.HtmlEncode(s);
        Console.WriteLine(s); // prints É
    }
}

Upvotes: 1

Related Questions