Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EmailField doesn't support Unicode #1228

Closed
kengruven opened this issue Feb 5, 2016 · 2 comments
Closed

EmailField doesn't support Unicode #1228

kengruven opened this issue Feb 5, 2016 · 2 comments

Comments

@kengruven
Copy link

>>> import mongoengine
>>> print(mongoengine.EmailField.EMAIL_REGEX.match("武@メール.グーグル"))
None

This type of email address is supported by Gmail.

@amcgregor
Copy link
Contributor

E-mail addresses aren't unicode. Even unicode ones aren't unicode, they're punycode IDN-encoded. Regular expressions are a universally terrible method of validating e-mail addresses, as well.

The example e-mail address you have given is actually:

"武"@xn--4dkua4c.xn--qcka1pmc

Which is valid and also doesn't match. Edited to also note that your original @ symbol isn't an ASCII @ symbol.

Ref: http://tools.ietf.org/html/rfc3490 amongst others.

@wojcikstefan
Copy link
Member

@kengruven thanks for reporting this! The fix for the issue is in the v0.13.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants