User Names and White-Spaces

17,710

Solution 1

I think in reality this is probably one of those conventions that needs to be broken. Most systems now deal with a lot of sophisticated data and are used to correctly processing text which includes spaces. I was delighted to discover that fogbugz (another plug) will accept your email address, your username or your real name, as you have entered it; as your username when you log on.

This is simply a convention that is still around from the days of 8 letter file names and probably also 8 letter user names. I would suggest you allow it in your web app and let the world follow you. :)

Solution 2

One subtle problem related to spaces in user names is that the space character is "invisible" and two consecutive spaces may look very similar to a single space. Errors that arise from entering two instead of one space can be hard to spot and this is one reason to disallow spaces all together.

Some systems may disallow spaces but still allow a non-breaking space. A smart user can use this fact to include a space in his user name.

Solution 3

I imagine because some code somewhere is still processing the input as a set of space seperated parameters, much the way the Windows command prompt handles unquoted file names. For example if you were to pass the user name to an external executable process, written in C, where the user name was passed on the command line, it would arrive in the C application as two arguments.

While this mightn't happen much in practice any more, much the same as many special characters, I guess its the reason why its there.

Share:
17,710
VarunGupta
Author by

VarunGupta

Updated on June 14, 2022

Comments

  • VarunGupta
    VarunGupta almost 2 years

    In past many years I have registered on various applications and platforms hosted online or offline.

    Why white-spaces are not allowed in User Names as spaces are very natural to names and most of the computing systems can handle them efficiently.

    (Many people can raise similar questions about other special characters which are illegal. But their case is far more understandable as they are not even natural to real world naming schemes. And surely!)

  • Matthew Scharley
    Matthew Scharley over 15 years
    As compared to JohnSm1th, and J0hnSmith? I just don't see this as a reason, sorry.
  • VarunGupta
    VarunGupta over 15 years
    Trimming chops off spaces (and other illegal characters) from the beginning and end of data, not between valid characters.
  • Nrj
    Nrj over 15 years
    What if user enters the password as pwd<space>
  • jedediah
    jedediah over 15 years
    Regardless of how you see it, this is in fact one of the reasons it is done.
  • VarunGupta
    VarunGupta over 15 years
    Though it wasn't specified exclusively but, ostensibly, this is not the case that we are discussing.
  • Russell Smith
    Russell Smith over 14 years
    If you're worried about multiple spaces, I would argue that a much more usable solution is to collapse multiple spaces into one rather than disallow them altogether.
  • Macha
    Macha about 14 years
    If the password is hashed (as it should be), then that isn't an issue.
  • Steve Byrne
    Steve Byrne almost 6 years
    I often times use white space in passwords, if it's accepted they probably hash it and I know my pw is a bit more secure. Any form of password filtering (disallowing characters, no white space, max length ect) is a huge red flag to me to leave the site and never come back.