You use htmlEncode to encode the string
You use htmlDecode to decode the string,
The encoding/decoding is done to remove whitespaces and special or escaped characters.
(" ") is simply non-breaking space
try this and see what you get
string text = " ";
string space = "";
text = HttpUtility.HtmlEncode(text);
space = HttpUtility.HtmlDecode(text);
if (String.Compare(space, text) == 0)
return true;
else
return false;