[hibernate-issues] [Hibernate-JIRA] Commented: (HV-472) E-Mail Validator does not validate IDN E-Mail-Addresses

Tom Schindl (JIRA) noreply at atlassian.com
Tue May 17 08:18:25 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42341#action_42341 ] 

Tom Schindl commented on HV-472:
--------------------------------

well should be quite easy to come up with one e.g. "myname@östereich.at" should be a valid address given that http://www.nic.at/service/technische_informationen/idn/zeichentabelle_konverter/ allows ö in its domain names. The real problem I see is that which values are allowed in a domain name differs from top-level to top-level domain (not even german speaking countries came across a common set of chars allowed)! So probably the savest (though not 100% accurate assumption could be to allow all unicode letter chars in the domain name) so a regex which passes the above could look like this:

private static String ATOM = "[a-z0-9!#$%&'*+/=?^_`{|}~-]";
private static String ATOM_DOMAIN = "[\\p{L}!#$%&'*+/=?^_`{|}~-]";

private static String DOMAIN = "(" + ATOM_DOMAIN + "+(\\."+ ATOM_DOMAIN + "+)*";
private static String IP_DOMAIN = "\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]";

private java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(
    "^" + ATOM + "+(\\." + ATOM + "+)*@" + DOMAIN + "|" + IP_DOMAIN + ")$", java.util.regex.Pattern.CASE_INSENSITIVE
);

> E-Mail Validator does not validate IDN E-Mail-Addresses
> -------------------------------------------------------
>
>                 Key: HV-472
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-472
>             Project: Hibernate Validator
>          Issue Type: Bug
>            Reporter: Tom Schindl
>
> It looks like the E-Mail-Address validator is not prepared to handle E-Mail-Addresses who allow IDN (e.g. german umlaute):
> * http://en.wikipedia.org/wiki/Internationalized_domain_name
> * http://en.wikipedia.org/wiki/List_of_top-level_domains
> * http://de.wikipedia.org/wiki/Internationalizing_Domain_Names_in_Applications

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list