Most likely you are sorting in a locale that discards information
about quotes and spaces before doing comparison. Try setting the
environment variable LC_ALL to "C" and then sorting. The command
"sort --help" talks about this briefly, and the documentation says
more.