I have a problem decoding HTML entities. I have tried using both
System.Net.WebUtility.HtmlDecode()
and in hopes that it was simply because this was a lightweight version of HttpUtilities, I’ve tried
HttpUtility.HtmlDecode()
as well.
My problem is that I need to decode from Entity names, not Entity Numbers.
(see this list http://www.w3schools.com/tags/ref_entities.asp )
Both of the beforementioned methods decode to and from entity numbers, NOT entity names.
I dont really see your problem. If I test the decoding via
WebUtility.HtmlDecode, all entity names that are listed in the link you posted are decoded:This small snippet yields true.
When it comes to encoding: The
HtmlEncodefunction is implemented to work just this way. There is little you can do about that, except from implementing it yourself, which I would not recommend (dont reinvent the wheel if you dont really need to). See also this SO question concerning the encoding: C# HtmlEncode – ISO-8859-1 Entity Names vs Numbers