Make email local-part accept Unicode characters
This commit is contained in:
parent
7c884afe5a
commit
14f58423fd
|
@ -176,7 +176,7 @@ class EmailValidator:
|
|||
code = "invalid"
|
||||
user_regex = _lazy_re_compile(
|
||||
# dot-atom
|
||||
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*\Z"
|
||||
r"(^[-!#$%&'*+/=?^`{}|~\w]+(\.[-!#$%&'*+/=?^`{}|~\w]+)*\Z"
|
||||
# quoted-string
|
||||
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])'
|
||||
r'*"\Z)',
|
||||
|
|
|
@ -313,6 +313,11 @@ TEST_DATA = [
|
|||
(validate_email, "example@inv-.alid-.com", ValidationError),
|
||||
(validate_email, "example@inv-.-alid.com", ValidationError),
|
||||
(validate_email, 'test@example.com\n\n<script src="x.js">', ValidationError),
|
||||
(validate_email, "ùnîcódë@valid.com", None),
|
||||
(validate_email, "统一码@例子.com", None),
|
||||
(validate_email, "统一码@例子.集团", None),
|
||||
(validate_email, "يونيكود@مثال.com", None),
|
||||
(validate_email, "يونيكود@مثال.الجزائر", None),
|
||||
# Quoted-string format (CR not allowed)
|
||||
(validate_email, '"\\\011"@here.com', None),
|
||||
(validate_email, '"\\\012"@here.com', ValidationError),
|
||||
|
|
Loading…
Reference in New Issue