nl.uva.vlet.util
Class URLUTF8Encoder

java.lang.Object
  extended by nl.uva.vlet.util.URLUTF8Encoder

public class URLUTF8Encoder
extends java.lang.Object

Provides a method to encode any string into a HTML-safe form. Non-ASCII characters are first encoded as sequences of two or three bytes, using the UTF-8 algorithm, before being encoded as %HH escapes.

Non Copyrighted Code from: http://www.w3.org/International/URLUTF8Encoder.java

Piter T. de Boer: modified so it can be used to encode URI's. Keeps '/' and ':' as allowed characters and DOESN'T encode space into '+' but '%20'. Decoding is done in the URI class.

See Also:
URI

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
 

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:

Parameters:
s - The string to be encoded
Returns:
The encoded string