HtmlDecode of html encoded space is not space
asp.net, c#, vb.net
Solution
The HTML entity ` ` doesn't represent a space, it represents a non-breaking space.
The non-breaking space has character code 160:
string nbspace = "\u00A0";
Also, as Marc Gravell noticed, you have double encoded the code, so you would need to decode it twice to get the character:
string text = " ";
text = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(text));
Problem
Till now I was thinking `HttpUtility.HtmlDecode(" ")` was a space. But the below code always returns false. ``` string text = " "; text = HttpUtility.HtmlDecode(text); string space = " "; if (String.Compare(space, text) == 0) return true; else return false; ``` Same when I try with `Server.HtmlDecode()` Why is it so? Any help would be much appreciated Thanks, N