[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reimplemented URLEncoder/Decoder

From: Tom Tromey
Subject: Re: Reimplemented URLEncoder/Decoder
Date: 07 Oct 2001 17:57:25 -0600

>>>>> "Mark" == Mark Wielaard <address@hidden> writes:

Mark>     * java/net/ Reimplement to take character encoding
Mark>     into account.
Mark>     * java/net/ Ditto

This is great.  Thanks for doing it.  I do have a couple nits to pick

Mark> Even though these version do more things some of my tests were
Mark> two times faster when compiled with gcj.


Mark>   * where XX is the hexadecimal representation of that character.  Note
Mark>   * that since unicode characters are 16 bits, and this method encodes 
Mark>   * 8 bits of information, the lower 8 bits of the character are used.

This part of the comment is now wrong.

Mark>       try
Mark>         {
Mark>           bytes[index] = (byte)Integer.parseInt(sub, 16);
Mark>           index++;
Mark>         }
Mark>       catch (NumberFormatException nfe)
Mark>         {
Mark>           // Ignore badly encoded char
Mark>         }

The 1.4 docs say that the implementation can either leave illegal
characters alone or it can throw IllegalArgumentException, but this
piece of code seems to do neither.  Maybe I'm misunderstanding the
docs?  Or maybe we should throw IllegalArgumentException here?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]