[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 08:20:29 PDT 2013
On 8/29/2013 10:57 PM, Michael McMahon wrote:
> Xuelei,
>
> This looks fine.
>
> I would add a comment to line 408-409 that says something like:
>
> Non LDH refers to characters in the ASCII range, but which
> are not letters, digits or the hypen.
>
I will add the comment. Thanks for the quick code review.
Xuelei
> That explains what exactly was fixed here.
>
> Michael
>
> On 29/08/13 13:46, Xuelei Fan wrote:
>> 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