org.jfree.layouting.util

Class UTFEncodingUtil

public class UTFEncodingUtil extends Object

Provides a method to encode any string into a URL-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.

Code is the public example given at http://www.w3.org/International/O-URL-code.html

Method Summary
static Stringdecode(String s, String encoding)
static StringdecodeUTF(String s)
static Stringencode(String s, String encoding)
static Stringencode(String s)
static StringencodeUTF8(String s)
Encode a string according to RFC 1738.

Method Detail

decode

public static String decode(String s, String encoding)

decodeUTF

public static String decodeUTF(String s)

encode

public static String encode(String s, String encoding)

encode

public static String encode(String s)

encodeUTF8

public static String encodeUTF8(String s)
Encode a string according to RFC 1738.

"...Only alphanumerics [0-9a-zA-Z], the special characters "$-_.+!*'()," [not including the quotes - ed], and reserved characters used for their reserved purposes may be used unencoded within a URL."

Parameters: s The string to be encoded

Returns: The encoded string