User Names and White-Spaces [closed]

2019-02-22 06:34发布

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!)

7条回答
家丑人穷心不美
2楼-- · 2019-02-22 07:13

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.

查看更多
叼着烟拽天下
3楼-- · 2019-02-22 07:14

I think because generally its a tendency to trim input field values before they are actually saved, say in Database.

Since we trim off the white spaces and if we allow them in password or user name, you can imagine there will be a big issue if user entered a password as "PWD ".

查看更多
该账号已被封号
4楼-- · 2019-02-22 07:17

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.

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2019-02-22 07:17

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. :)

查看更多
等我变得足够好
6楼-- · 2019-02-22 07:17

It prevents confusingly similar name combinations e.g. "John Smith" and "JohnSmith". It also makes it easier to automatically recognize names that appear within text.

查看更多
The star\"
7楼-- · 2019-02-22 07:22

The only reason I know of that makes any sense is that if you're parsing tokens on whitespace, putting space in a user name will cause it to fail.

However, I do agree with you: in today's environment, there's probably not a lot of reason to continue doing it, except where legacy compatibility makes sense (*nix, etc).

查看更多
登录 后发表回答