Skip navigation links

Oracle® Database Globalization Development Kit Java API Reference
11g Release 2 (11.2)

E10730-01


oracle.i18n.net
Class URLEncoder

java.lang.Object
  extended by oracle.i18n.net.URLEncoder


public class URLEncoder
extends Object

The URLEncoder contains a utility method for converting a String object into a MIME format called x-www-form-urlencoded format.

To convert a String object, each character is examined in turn:

When you encode a full set of URL string, for example, http://www.acme.com/, it is troublesome to encode special meaning characters such as ':' and '/'. To avoid encoding, you can set the parameter of escResChar to false. The following characters will not be encoded:

By default, escResChar is true.

For information about URL encode/decode, see RFC 1738.

Since:
10.1.0.2
See Also:
RFC 1738

Method Summary
static String encode(String s)
          Encodes a String object into x-www-form-urlencoded format using UTF-8 character set encoding.
static String encode(String s, boolean escResChar)
          Encodes a String object into x-www-form-urlencoded format using UTF-8 character set encoding.
static String encode(String s, boolean escResChar, String enc)
          Encodes a string object into x-www-form-urlencoded format.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

encode

public static String encode(String s)
Encodes a String object into x-www-form-urlencoded format using UTF-8 character set encoding. Any reserved characters are encoded.
Parameters:
s - a String object to be encoded
Returns:
the translated String object

encode

public static String encode(String s,
                            boolean escResChar)
Encodes a String object into x-www-form-urlencoded format using UTF-8 character set encoding. escResChar determines whether it encodes the reserved characters .
Parameters:
s - a String ojbect to be translated
escResChar - determines whether to encode the reserved characters; true - encode (default), false - don't encode
Returns:
the translated String object
Throws:
IllegalStateException - if UTF-8 is not supported by JVM

encode

public static String encode(String s,
                            boolean escResChar,
                            String enc)
                     throws UnsupportedEncodingException
Encodes a string object into x-www-form-urlencoded format.

Currently AL16UTF16(also known as UTF-16BE) is not supported.

Parameters:
s - a String object to be translated
escResChar - determines whether to encode the reserved characters; true - encode (default), false - don't encode
enc - the name of an Oracle or IANA character set
Returns:
the translated String object
Throws:
UnsupportedEncodingException - if the character set is not supported

Skip navigation links

Oracle® Database Globalization Development Kit Java API Reference
11g Release 2 (11.2)

E10730-01


Copyright © 2003, 2009, Oracle. All rights reserved.