[
http://opensource.atlassian.com/projects/hibernate/browse/HV-472?page=com...
]
Hardy Ferentschik edited comment on HV-472 at 12/5/11 5:29 AM:
---------------------------------------------------------------
well should be quite easy to come up with one e.g. "myname(a)xn--stereich-m4a.at" should
be a valid address given that
http://www.nic.at/service/technische_informationen/idn/zeichentabelle_kon... 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:
{code}
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
);
{code}
was (Author: tomsontom):
well should be quite easy to come up with one e.g. "myname(a)xn--stereich-m4a.at"
should be a valid address given that
http://www.nic.at/service/technische_informationen/idn/zeichentabelle_kon... 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
Components: validators
Affects Versions: 4.2.0.Final
Reporter: Tom Schindl
Fix For: 4.3.0.next
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.
For more information on JIRA, see:
http://www.atlassian.com/software/jira