classpath
[Top][All Lists]
Advanced

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

Reimplemented URLEncoder/Decoder


From: Mark Wielaard
Subject: Reimplemented URLEncoder/Decoder
Date: Sun, 7 Oct 2001 21:59:59 +0200
User-agent: Mutt/1.3.22i

Hi,

While trying to merge the URLEncoder/Decoder with libgcj I noticed that the
latest 1.4 spec defines these classes a little bit different then in past
versions. It is now possible to specify which character encoding to use
to en/decode the hex-encoded unsafe characters. And by default UTF-8 is used.
I have reimplemented both classes to actually take the encoding into account.

Older specs did not clearly specify which character encoding would be used
or implied that only the lower 8 bits would be used when encoding (which
works fine if only 'normal' iso-8859-1 characters are used.

This does mean that the default behaviour is now slightly different from the
old one. But since it was never clearly defined in the past I don't think
that is a real problem. And a friend (hi Erwin) told me that the Sun
implementations also didn't do the same thing in different versions or on
different platforms.

2001-10-07  Mark Wielaard  <address@hidden>

    * java/net/URLDecoder.java: Reimplement to take character encoding
    into account.
    * java/net/URLEncoder.java: Ditto

If nobody objects I will check these in. The new versions are attached.

Even though these version do more things some of my tests were two times
faster when compiled with gcj. I think the use of a StringBuffer in the
URLEncoder made a large difference.

Cheers,

Mark
-- 
Stuff to read:
    <http://www.toad.com/gnu/whatswrong.html>
  What's Wrong with Copy Protection, by John Gilmore

Attachment: URLDecoder.java
Description: Text Data

Attachment: URLEncoder.java
Description: Text Data


reply via email to

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