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

Email validator accepts special character "¸" which should not be valid #2360

Open
RaminGe opened this issue Jan 16, 2024 · 7 comments
Open
Labels

Comments

@RaminGe
Copy link

RaminGe commented Jan 16, 2024

Describe the bug
This email is invalid but the validator returns that it is valid: te¸st@test.com

Examples

// Current behaviour:
console.log(validator.isEmail('te¸st@test.com')); // => true

// Expected behaviour:
console.log(validator.isEmail('te¸st@test.com')); // => false

Additional context
Validator.js version: 13.11.0 (latest)

@WikiRik
Copy link
Member

WikiRik commented Jan 16, 2024

I'm not knowledgeable enough about the exact email standards to determine if this is a bug or not, but you can set the allow_utf8_local_part option to false to mark the email address you provided as invalid.
From the README; "If allow_utf8_local_part is set to false, the validator will not allow any non-English UTF8 character in email address' local part"

@RaminGe
Copy link
Author

RaminGe commented Jan 17, 2024

Thanks @WikiRik I'll use this option. I still think it's an invalid email address in general so I guess it makes sense to show it as invalid in general but maybe it needs some more research to be sure.

@devmanbud
Copy link
Contributor

I've changed allow_utf8_local_part set to false how do I test it?

@RaminGe
Copy link
Author

RaminGe commented Jan 30, 2024

I've changed allow_utf8_local_part set to false how do I test it?

Simply pass the email to the function and log it:

// allow_utf8_local_part === false:
console.log(validator.isEmail('te¸st@test.com')); // => true

// allow_utf8_local_part === true:
console.log(validator.isEmail('te¸st@test.com')); // => false

@devmanbud
Copy link
Contributor

how do I log this

@devmanbud
Copy link
Contributor

run*

@Sumit-tech-joshi
Copy link
Contributor

Created pull request for the bug fix: #2384

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

No branches or pull requests

4 participants