是否允许电子邮件地址包含非字母数字字符? [英] Are email addresses allowed to contain non-alphanumeric characters?
问题描述
我只想知道电子邮件地址可能包含哪些类型的字符有什么技术限制。
电子邮件地址只允许包含英文字母,数字_,@和。?
$ b $是否允许包含非英文字母,如é或ü?
是否允许包含中文或日文或其他Unicode字符?
电子邮件地址两个部分 本地
之前@和域
。
这些部分的规则是不同的:
对于本地部分
您可以使用ASCII:
- 拉丁字母A - Z a - z
- 数字0 - 9
- 特殊字符#$%&'* + - / =?^ _`{|}〜
- 空格和(),...;<> @ []字符是允许的限制(它们只允许在引用字符串,反斜杠或双引号之前必须有反斜杠)
- Plus自2012年以来您可以使用国际上述字符
U + 007F
,编码为为UTF-8 。
<它不是第一个还是最后一个,而不是顺序
域名
更受限制:
- 拉丁字母A - Z a - z
- 数字0 - 9
- 连字符 - 不是第一个或最后一个,允许连续的多个连字符。
^(([^]()\ [\] \。,;:\s @ \ ] +(。\ [^<>()\ [\] \。,;:\s @ \] +)* )|(。+ \ \))@(([^<>()[\] \;:\s @ \。] + \)+ [^。 <>()[\] \。,;:\s @ \] {2,})
I'm building a website using `Django. The website could have significant users from non-English speaking countries.
I just want to know if there are any technical restrictions on what types of characters an email address could contain.
Are email addresses only allowed to contain English alphabets, numbers, "_", "@" and "."?
Are they allowed to contain non-English alphabets like "é" or "ü"?
Are they allowed to contain Chinese or Japanese or other Unicode characters?
Email address consists of two parts local
before @ and domain
that goes after.
Rules to these parts are different:
For local part
you can use ASCII:
- Latin letters A - Z a - z
- digits 0 - 9
- special characters !#$%&'*+-/=?^_`{|}~
- dot ., that it is not first or last, and not in sequence
- space and "(),:;<>@[] characters are allowed with restrictions (they are only allowed inside a quoted string, a backslash or double-quote must be preceded by a backslash)
- Plus since 2012 you can use international characters above
U+007F
, encoded as UTF-8.
Domain part
is more restricted:
- Latin letters A - Z a - z
- digits 0 - 9
- hyphen -, that is not first or last, multiple hyphens in sequence are allowed.
^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})
Hope this saves you some time.
这篇关于是否允许电子邮件地址包含非字母数字字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!