Keats/validator

Email with UTF-8 characters

Opened this issue · 1 comments

Hi, I was comparing this crate with email_address crate

And I have an email with a controversial character � - https://en.wikipedia.org/wiki/Specials_(Unicode_block)
Then email_address and validator do not agree if it is valid or not abc�def@example.com

let email = "abc�def@example.com";
EmailAddress::from_str(email).is_ok(); // true
validator::validate_email(email);  // false

According to RFC6531 - UTF-8 characters should be allowed in the email however, it is often not very practical.

Perhaps the solution could be adding some parse options to the email validator.
Probably the best thing for the community would be to have just one crate for email validation and cooperation between email_address and validator.

Refs:

Our validation is very simple: https://github.com/Keats/validator/blob/master/validator/src/validation/email.rs#L8-L18 we just use whatever the HTML spec allows. So it will reject potentially valid email addresses as indicated in a comment in those lines.