I am using .net 4.5 and
HttpUtility.HtmlDecode
fails to decode '
which is single quote character
Any idea why ?
Using C# .net 4.5 WPF on windows 8.1
Here the text that is failed
Apple 13'' Z0RA30256 MacBook Pro Retina
Below is framework version
#region Assembly System.Web.dll, v4.0.0.0
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll
#endregion
It's not possible to handle this with the built it
HtmlDecode
method, you would have to find/replace it or otherwise work around.Below is the source code for
HtmlDecode
- you can see from the comment explicitly that your scenario is considered and not supported - HTML entities have to be bounded with a;
, otherwise they are simply not HTML entities. Browsers are forgiving of the incorrect markup, and compensate accordingly.Here is the full source of the .NET
HtmlDecode
inHttpUtility
, if you want to adapt the behaviour.http://referencesource.microsoft.com/#System/net/System/Net/WebUtility.cs,44d08941e6aeb00d