Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.nzdl.gsdl.Phind
Class URLUTF8Encoder  view URLUTF8Encoder download URLUTF8Encoder.java

java.lang.Object
  extended byorg.nzdl.gsdl.Phind.URLUTF8Encoder

public class URLUTF8Encoder
extends java.lang.Object


Field Summary
(package private) static java.lang.String[] hex
           
 
Constructor Summary
URLUTF8Encoder()
           
 
Method Summary
static java.lang.String encode(java.lang.String s)
          Encode a string to the "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hex

static final java.lang.String[] hex
Constructor Detail

URLUTF8Encoder

public URLUTF8Encoder()
Method Detail

encode

public static java.lang.String encode(java.lang.String s)
Encode a string to the "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal. This is what happens:
  • The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.

  • The space character ' ' is converted into a plus sign '+'.

  • All other ASCII characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the character code

  • All non-ASCII characters are encoded in two steps: first to a sequence of 2 or 3 bytes, using the UTF-8 algorithm; secondly each of these bytes is encoded as "%xx".