Should uppercase letters be allowed in email addresses?
The official RFC documents state that we can use both upper and lowercase letters in the "local" part of the domain (plus many other crazy things).
However, what is common in the real world - and what the spec say are two different things. None of those extra characters ( ! # $ % & ' * / = ? ^ { | } ~
) are allowed in emails from large providers like yahoo, google, or hotmail. In addition, it is very, very rare to see an email that contains capital letters (JohnDoe@example.com).
I sent myself a couple emails today using different upper and lowercase combos and found that my email servers all treated them as the same account ignoring the fact that the letter casing was different. In other words, JohnDoe@example.com = johndoe@example.com to my email servers (including my free email accounts).
Should I act on the format the world has chosen - and standardize/lowercase all ANSII emails? Or should I allow users to register multiple accounts as JohnDoe@example.com, johndoe@example.com, and JOHNdoe@example.com?
Probably, the correct compromise is to let them register with the capitalization of their choice, and show that where appropriate ("JOHNdoe@example.com Inbox"). But you should canonicalize the capitalization for uniqueness checks, since there are many badly behaved email senders that eg capitalize the entire email address before sending.
The reason for the standard was so that non-Unix systems could participate in the ARPAnet and later Internet with minimal hassles. (VMS and Tenex were common in the former, and BITNET was also represented. In the latter at least, lowercase characters required 3278 or upgraded 3270 terminals.) These days, it's best to ignore case in the localpart, as everyone has figured out how to use lowercase out of necessity.
In Microsoft SQL server, by default, indexes are case insensitive.
If you put a unique index on the field, the user can have a reader-friendly CamelCase name like JohnDoe@acme.org and duplicates like johndoe@ACME.org will be rejected automatically.
链接地址: http://www.djcxy.com/p/92872.html上一篇: 从字符串检索完整的电子邮件地址
下一篇: 应该在电子邮件地址中使用大写字母吗?