开发者

Why are accents accepted in sfValidatorEmail?

开发者 https://www.devze.com 2023-02-11 17:10 出处:网络
There was a bug in my application, apparently accent开发者_高级运维s in an email address where not considered an error and the sfMailer was crashing an error because of this.

There was a bug in my application, apparently accent开发者_高级运维s in an email address where not considered an error and the sfMailer was crashing an error because of this.

Digging through my code I realized I wasn't to blame.

sfValidatorEmail uses this regular expression:

const REGEX_EMAIL = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i';

Accents in the first part of the email are accepted.

Should sfValidatorEmail not accept accents or should sfMailer accept it?


sfMailer should accept it. It is legitimate to have accents in the first part of the email address.


According to wikipedia accents are valid. Off course, in practice, in webprogramming, I try to avoid anything (spaces, accents,...) that can upset the 'internet middle layer' (i.e. routers, servers, etc).

0

精彩评论

暂无评论...
验证码 换一张
取 消