public final class UrlEncoder
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.nio.charset.Charset |
DEFAULT_ENCODING
The default character encoding.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
decode(java.lang.String source)
Percent-decodes a US-ASCII string into a Unicode string.
|
static java.lang.String |
decode(java.lang.String source,
java.nio.charset.Charset encoding)
Percent-decodes a US-ASCII string into Unicode string.
|
static java.lang.String |
encode(java.lang.String source)
Percent-encodes a Unicode string into a US-ASCII string.
|
static java.lang.String |
encode(java.lang.String source,
java.nio.charset.Charset encoding)
Percent-encodes a Unicode string into US-ASCII string.
|
public static final java.nio.charset.Charset DEFAULT_ENCODING
public static java.lang.String encode(java.lang.String source)
This replaces ' ' with '+'. So this method should not be used for non application/x-www-form-urlencoded strings such as host and path.
source - a Unicode string.public static java.lang.String encode(java.lang.String source,
java.nio.charset.Charset encoding)
This replaces ' ' with '+'. So this method should not be used for non application/x-www-form-urlencoded strings such as host and path.
source - a String to encode.encoding - a character encoding.public static java.lang.String decode(java.lang.String source)
This replaces '+' with ' '. So this method should not be used for non application/x-www-form-urlencoded string such as host and path.
source - a percent-encoded US-ASCII string.public static java.lang.String decode(java.lang.String source,
java.nio.charset.Charset encoding)
This replaces '+' with ' '. So this method should not be used for non application/x-www-form-urlencoded string such as host and path.
source - a percent-encoded US-ASCII string.encoding - a character encoding.