Opened 2 years ago

Last modified 3 months ago

#27029 assigned Cleanup/optimization

Make EmailValidator accept non-ASCII characters

Reported by: Ramin Farajpour Cami Owned by: Wout De Puysseleir
Component: Core (Other) Version: master
Severity: Normal Keywords:
Cc: Florian Apolloner Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

from django.core.validators import validate_email
validate_email('うえあいお@email.com')

if you check this url email chacker with うえあいお@address.com , this is not valid email address ,

Thanks,
Ramin

Change History (24)

comment:1 Changed 2 years ago by Claude Paroz

Resolution: duplicate
Status: newclosed

Sure thing!
Duplicate of #26423

comment:2 Changed 2 years ago by Claude Paroz

Has patch: set
Resolution: duplicate
Status: closednew
Triage Stage: UnreviewedAccepted
Version: 1.10master

Reopening as I have a patch which targets this specific issue.

comment:3 in reply to:  2 Changed 2 years ago by Ramin Farajpour Cami

Replying to claudep:

Reopening as I have a patch which targets this specific issue.

Hi,

Thanks a lot,

comment:4 Changed 2 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:5 Changed 2 years ago by Claude Paroz

I'm just wondering, is there still a use case to keep ASCII-only validation (and hence provide validate_email_ascii)?

comment:6 Changed 2 years ago by Tim Graham

Not sure, maybe you want to ask on the DevelopersMailingList. I guess usage might be a bit difficult until #25594 is fixed.

comment:7 Changed 2 years ago by Claude Paroz

Triage Stage: Ready for checkinAccepted

I just tested Firefox and Chrome email validation, and they don't accept non-ASCII in the local part.

In any case, I think we should provide both validators (ASCII-only and Unicode). It might be a bit too soon to unconditionally allow Unicode in emails.

comment:8 Changed 2 years ago by Claude Paroz

Patch needs improvement: set

comment:9 Changed 2 years ago by Tim Graham

Summary: invalid email addresses input django validate_emailMake EmailVadliator accept non-ASCII characters
Type: BugCleanup/optimization

See #21859 for a documentation request to clarify the state of ASCII/Unicode email addresses in Django.

comment:10 Changed 2 years ago by Tim Graham

Summary: Make EmailVadliator accept non-ASCII charactersMake EmailValidator accept non-ASCII characters

comment:11 Changed 2 years ago by Ramin Farajpour Cami

Hi Tim,

Please merge PR ,
Thanks

comment:12 Changed 2 years ago by Claude Paroz

Hey RaminFP,
I plan to come with a new patch, with two versions of the email validator. I don't think that non-ASCII local parts of email addresses are widespread enough to set it by default. The idea is that you could easily opt-in for the Unicode validator of your choice when you define the field in your models.

comment:13 in reply to:  12 Changed 2 years ago by Ramin Farajpour Cami

Replying to claudep:

Hey RaminFP,
I plan to come with a new patch, with two versions of the email validator. I don't think that non-ASCII local parts of email addresses are widespread enough to set it by default. The idea is that you could easily opt-in for the Unicode validator of your choice when you define the field in your models.

Will be fix in new version 1.11? i can make suggestions to fix?

comment:14 Changed 2 years ago by Claude Paroz

Yes, the plan is clearly to include that in 1.11. We still have some months ahead :-)

comment:15 in reply to:  14 Changed 2 years ago by Ramin Farajpour Cami

Replying to claudep:

Yes, the plan is clearly to include that in 1.11. We still have some months ahead :-)

Owesome, i have one question, you have CONTRIBUTORS LIST i can add this list? or no i should try for send a lot of report for added to list contributors?

comment:16 Changed 2 years ago by Claude Paroz

Yes, you are supposed to have done significant work for Django to be listed there. Of course, that's very subjective, but filling a couple of reports isn't sufficient for that.

comment:17 Changed 2 years ago by Ramin Farajpour Cami

Very good, i like working with Django community always in security and see code issue for fix it,i see you write PR for this report so I can't add my name to ​CONTRIBUTORS LIST, :((

Thanks,

comment:18 Changed 2 years ago by Ramin Farajpour Cami

Hi,
I see here way Contributing to Django
https://docs.djangoproject.com/en/dev/internals/contributing/
You write PR for patch issue ,this means my name not added?

comment:19 Changed 2 years ago by Tim Graham

Yes, we add to AUTHORS based on code contributions not bug reports.

comment:20 Changed 22 months ago by Wout De Puysseleir

Owner: changed from Ramin Farajpour Cami to Wout De Puysseleir
Patch needs improvement: unset
Status: newassigned

PR

I've added a new patch for this.

comment:21 Changed 22 months ago by Florian Apolloner

Patch needs improvement: set

I am against this patch, adding more regular expressions is the wrong way to go. I'd like to propose to change the current email validator to just check if "@" is in the address and be done with it. See also https://davidcel.is/posts/stop-validating-email-addresses-with-regex/ -- I think this is something which should have a bit of discussion on the mailing list.

comment:22 Changed 22 months ago by Florian Apolloner

Cc: Florian Apolloner added

comment:23 Changed 21 months ago by Tim Graham

Ideas about simplification are discussed in #26423 and on the django-developers mailing list.

comment:24 Changed 3 months ago by Collin Anderson

if we do allow non-ascii, I wonder if we should be sure the email is "printable" (not allow hidden characters like '\u200b') https://docs.python.org/3/library/stdtypes.html#str.isprintable

Note: See TracTickets for help on using tickets.
Back to Top