|
Oracle® Database Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.i18n.net.URLEncoder
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:
a
' through 'z
',
'A
' through 'Z
', '0
' through
'9
', and ".", "-", "",
"_" remain the same.
' is converted into a plus sign
'+
'.
%xy
", where xy is the two-digit hexadecimal
representation of the lower 8-bits of the character.
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:
;
- Semicolon (U+003B)
/
- Forward slash (U+002F)
?
- Question mark (U+003F)
:
- Colon (U+003A)
(
- At sign (U+0040)
&
- Ampersand (U+0026)
=
- Equal sign (U+002D)
+
- Plus sign (U+002B)
$
- Dollar sign (U+0024)
,
- Comma (U+002C)
By default, escResChar
is true
.
For information about URL encode/decode, see 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 |
public static String encode(String s)
String
object into x-www-form-urlencoded
format using UTF-8 character set encoding. Any reserved characters are
encoded.
s
- a String
object to be encoded
String
objectpublic static String encode(String s, boolean escResChar)
String
object
into x-www-form-urlencoded
format using UTF-8 character set encoding. escResChar
determines whether it encodes the reserved characters .
s
- a String
ojbect to be translatedescResChar
- determines whether to encode the reserved characters;
true
- encode (default), false
- don't
encode
String
object
IllegalStateException
- if UTF-8 is not supported by JVMpublic static String encode(String s, boolean escResChar, String enc) throws UnsupportedEncodingException
string
object into
x-www-form-urlencoded
format.
Currently AL16UTF16(also known as UTF-16BE) is not supported.
s
- a String
object to be translatedescResChar
- determines whether to encode the reserved characters;
true
- encode (default), false
- don't
encodeenc
- the name of an Oracle or IANA character set
String
object
UnsupportedEncodingException
- if the character set is not
supported
|
Oracle® Database Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |