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

Unicode flag in email validation #290

Open
gaelreyrol opened this issue Aug 31, 2023 · 0 comments
Open

Unicode flag in email validation #290

gaelreyrol opened this issue Aug 31, 2023 · 0 comments

Comments

@gaelreyrol
Copy link

gaelreyrol commented Aug 31, 2023

Hi,

I noticed that the assertion made by Assertion::email() does not allow Unicode characters. Since 2012, Unicode characters above U+007F encoded as UTF-8 are allowed in the local part.

PHP 7.1 added the flag FILTER_FLAG_EMAIL_UNICODE that can be used with FILTER_VALIDATE_EMAIL to accept those Unicode characters.

filter_var($value, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_UNICODE)

A simple test with two emails allows to check the difference:

  • foo@bar.com
  • föö@bar.com

I can submit a PR to add the flag with an extra argument but maybe you would prefer to add a new method so I prefer to discuss it here before.

Regards

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

No branches or pull requests

1 participant