|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.extensions.surf.util.URLEncoder
public final class URLEncoder
UTF-8 URL character encoder. Based on an optimized and improved version of the w3 Consortium URLUTF8Encoder class.
Constructor Summary | |
---|---|
URLEncoder()
|
Method Summary | |
---|---|
static String |
encode(String s)
|
static String |
encodeUri(String s)
Encode a string to the UTF-8-in-URL proposal. |
static String |
encodeUriComponent(String s)
Encode a string to the UTF-8-in-URL proposal. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public URLEncoder()
Method Detail |
---|
public static String encode(String s)
public static String encodeUriComponent(String s)
The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.
The unreserved characters - _ . ! ~ * ( ) remain the same.
The unreserved character ' is converted into "%27" - it is NOT left unencoded!
The space character ' ' is converted into "%20" - NOT a plus sign!
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".
s
- The string to be encoded
public static String encodeUri(String s)
The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.
The URI reserved characters ; , / ? : @ & = + $ remain the same.
The unreserved characters - _ . ! ~ * ( ) remain the same.
The unreserved character ' is converted into "%27" - it is NOT left unencoded!
The space character ' ' is converted into "%20" - NOT a plus sign!
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".
s
- The string to be encoded
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |