How to validate non-english (UTF-8) encoded email address in Javascript and PHP? -
part of website working on contains registration process users have provide email address. became aware non-ascii based domains possible (so email). backend utf-8 encoded mysql expecting users (with differnt locales) should able enter email don't know how validate kind of email address.
currently testing out jquery tools , validates english email address correctly fails validate non ascii email. need same @ server side php. there regular expression can validate kind of email address?
i have tried fails in jquery tools (this example demo, don't understand too)
闪闪发光@闪闪发光.com
also happen when type english email address (jonesmith@somemail.com) own ime. can validated current regular expression have english mail validation. don't have worry if email exist not.
thanks
attempting validate email addresses may not idea. specifications (rfc5321, rfc5322) allow flexibility validating them regular expressions literally impossible, , validating function great deal of work. result of email validation schemes end rejecting large number of valid email addresses, inconvenience of users. (by far common example of not allowing +
character.)
it more user (accidentally or deliberately) enter incorrect email address in invalid one, validating great deal of work little benefit, possible costs if incorrectly.
i recommend check presence of @
character on client , send confirmation email verify it; it's practical way validate , confirms address correct well.
Comments
Post a Comment