非拉丁电子邮件地址验证 [英] non-latin email address validation

查看:160
本文介绍了非拉丁电子邮件地址验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在ICAN允许非拉丁字符域名,我应该关心电子邮件验证吗?目前,我的网站正在使用php函数来确保电子邮件地址的每个段中的一些字母数字字符集。这些其他字符集,如西里尔文,阿拉伯文和中文,是否通过验证?有没有推荐使用php函数?

解决方案

我认为最好的方法是使用正确的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆