| java.lang.Object org.jfree.report.util.UTFEncodingUtil
UTFEncodingUtil | public class UTFEncodingUtil (Code) | | 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
author: Bert Bos |
Method Summary | |
public static String | decode(String s, String encoding) Decodes the given string using the provided encoding. | public static String | decodeUTF(String s) Decodes the given string using the encoding UTF-8.
Parameters: s - the string that should be encoded. | public static String | encode(String s, String encoding) Encodes thh given string using the provided encoding. | public static String | encode(String s) Encodes the given string using the encoding defined in the report configuration. | 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."
The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.
The unreserved characters - _ . |
decode | public static String decode(String s, String encoding) throws UnsupportedEncodingException(Code) | | Decodes the given string using the provided encoding. The encoding must be a valid
Java-encoding.
Parameters: s - the string that should be encoded. Parameters: encoding - the encoding to tranform the bytes into a string. the encoded string. throws: UnsupportedEncodingException - if the specified encoding is not recognized. |
decodeUTF | public static String decodeUTF(String s)(Code) | | Decodes the given string using the encoding UTF-8.
Parameters: s - the string that should be encoded. the encoded string. |
encode | public static String encode(String s, String encoding) throws UnsupportedEncodingException(Code) | | Encodes thh given string using the provided encoding. The encoding must be a valid Java-encoding.
Parameters: s - the string that should be encoded. Parameters: encoding - the encoding to tranform the string into bytes. the encoded string. throws: UnsupportedEncodingException - if the specified encoding is not recognized. |
encode | public static String encode(String s) throws UnsupportedEncodingException(Code) | | Encodes the given string using the encoding defined in the report configuration. The encoding will be read from the
global report configuration using the key "org.jfree.report.URLEncoding" as key. The encoding must be a valid
Java-encoding.
Parameters: s - the string that should be encoded. the encoded string. throws: UnsupportedEncodingException - if the specified encoding is not recognized. |
encodeUTF8 | public static String encodeUTF8(String s)(Code) | | 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."
The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.
The unreserved characters - _ . ! ~ * ' ( ) remain the same.
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".
Parameters: s - The string to be encoded The encoded string |
|
|