The comparison operator <> is not a strict operator. That means, it trims leading and trailing spaces off the strings before doing the comparison. So if you take a string that is all spaces, it gets trimmed down to an empty string. And of course, the two empty strings are equal.
If leading/trailing spaces are important, then use a strict operator such as \==.