非拉丁电子邮件地址验证 [英] non-latin email address validation
问题描述
我认为最好的方法是使用正确的IDN函数来转换将传入的字符串转换为ACE字符串( xn--xyz-blah.com
)。如果该过程有效,则域名有效。如果没有,不是。
有一个名为 idn_to_ascii()
这样做,但它需要额外的库。你必须看看它是否在您的系统上可用。
似乎还有一个名为 idn的外部Linux命令
进行IDN转换。如果您只想使用PHP内置方法,delfuego会在这个问题看起来很不错。
Now that ICann is allowing non-latin-character domain names, should I be concerned about e-mail validation? Currently, my sites are using php functions to ensure some alpha-numeric character set in each segment of an email address. Will these other character sets, such as Cyrillic, Arabic, and Chinese, pass validation? Are there recommended php functions to utilize for this?
I think the ultimately best way would be using a proper IDN function to convert the incoming string into an ACE string (xn--xyz-blah.com
). If that process works, the domain name is valid. If it doesn't, it isn't.
There is a PHP function named idn_to_ascii()
that does this, but it needs additional libraries. You'd have to see whether it is available on your system.
There also seems to be an external Linux command named idn
that does IDN conversions. I don't know anything further about it, though.
If you want to use PHP built-in methods only, delfuego provides a regular expression in this question that looks very good.
这篇关于非拉丁电子邮件地址验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!