#27029: Make EmailValidator accept non-ASCII characters in local part -------------------------------------+------------------------------------- Reporter: Ramin Farajpour | Owner: j-bernard Cami | Type: | Status: assigned Cleanup/optimization | Component: Core (Other) | Version: dev Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Comment (by Mike Edmunds):
Per some of the earlier comments here, I've proposed a simplified EmailValidator (that would also allow EAI local parts) at https://forum.djangoproject.com/t/emailvalidator-simplification-and- international-email-addresses/39985/11. If that receives support, it would obsolete this ticket. But if that simplified proposal—or something like it—is ''not'' accepted (and this ticket remains accepted), then this ticket will need to be addressed by following RFC 6532 to allow UTF8-non-ascii characters in the EmailValidator user_regex, in both the dot-atom and quoted-string parts. Since this is a potentially breaking change, it would need to be opt-in, e.g. via a new `accept_eai_user` EmailValidator keyword param (like DomainNameValidator's `accept_idna`, but defaulting to False). To address concerns about regular expression complexity, it would probably be helpful to break up EmailValidator's user_regex into simpler components, similar to what was done in DomainNameValidator. (I suggest using the RFC 5322 terms: atom, dot_atom, qtext, quoted_pair, quoted_string. Since RFC 6532 is specified using those same terms, it should help with reviewing a PR for this ticket.) Incidentally, as of April 2025, no major browser allows non-ASCII local- parts in an `<input type=email>`. (There's a lengthy and ongoing [https://github.com/whatwg/html/issues/4562 WHATWG discussion about EAI].) But EmailValidator is ''not'' just for email addresses that come from a browser input field, and EAI addresses ''are'' valid email addresses in a context where you're trying to support EAI. -- Ticket URL: <https://code.djangoproject.com/ticket/27029#comment:40> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/django-updates/01070196835b38ee-61701a5a-f110-4119-8bb3-6d5155353093-000000%40eu-central-1.amazonses.com.