[JDK 8] Code review request JDK-8023881, IDN.USE_STD3_ASCII_RULES option is too strict to use Unicode in IDN.toASCII
Xuelei Fan
xuelei.fan at oracle.com
Thu Aug 29 05:46:51 PDT 2013
Hi,
Please review the fix of JDK-8023881.
webrev: http://cr.openjdk.java.net/~xuelei/8023881/webrev.00/
This bug has not been ported to bugs.sun.com. The following is the
descirption of the issue.
--------------------------------------------------------
IDN.toASCII("示例.com", IDN.USE_STD3_ASCII_RULES) throws:
Exception ... java.lang.IllegalArgumentException: Contains non-LDH
characters
at java.net.IDN.toASCIIInternal(IDN.java:275)
at java.net.IDN.toASCII(IDN.java:118)
However, the "idn" tool is able to handle above IDN properly:
$ idn --usestd3asciirules www.示例.com
www.xn--fsq092h.com
Per step 3, section 4.1, RFC 3490:
3. If the UseSTD3ASCIIRules flag is set, then perform these checks:
(a) Verify the absence of non-LDH ASCII code points; that is, the
absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
(b) Verify the absence of leading and trailing hyphen-minus; that
is, the absence of U+002D at the beginning and end of the
sequence.
However, in the impl of IDN is checking far more strictly than above.
Unicode point bigger than 0x007A is not acceptable. It is too strict to
convert Unicode with IDN.toASCII() if IDN.USE_STD3_ASCII_RULES option is
set.
--------------------------------------------------------
Thanks,
Xuelei
More information about the net-dev
mailing list