|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.net.URLEncoder
public class URLEncoder
This utility class contains static methods that converts a string into a fully encoded URL string in x-www-form-urlencoded format. This format replaces certain disallowed characters with encoded equivalents. All upper case and lower case letters in the US alphabet remain as is, the space character (' ') is replaced with '+' sign, and all other characters are converted to a "%XX" format where XX is the hexadecimal representation of that character in a certain encoding (by default, the platform encoding, though the standard is "UTF-8").
This method is very useful for encoding strings to be sent to CGI scripts
Method Summary | |
---|---|
static String |
encode(String s)
Deprecated. |
static String |
encode(String s,
String encoding)
This method translates the passed in string into x-www-form-urlencoded format using the character encoding to hex-encode the unsafe characters. |
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)
s
- The String to convert
public static String encode(String s, String encoding) throws UnsupportedEncodingException
s
- The String to convertencoding
- The encoding to use for unsafe characters
UnsupportedEncodingException
- If the named encoding is not
supported
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |