java.net
Class URLDecoder
java.lang.Object
|
+--java.net.URLDecoder
public class
URLDecoderextends
Object This utility class contains static methods that converts a
string encoded in the x-www-form-urlencoded format to the original
text. The x-www-form-urlencoded 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 given character encoding (default is "UTF-8").
This method is very useful for decoding strings sent to CGI scripts
Written using on-line Java Platform 1.2/1.4 API Specification.
Status: Believed complete and correct.
Since:Authors:- Warren Levy <warrenl@cygnus.com>
- Aaron M. Renn (arenn@urbanophile.com) (documentation comments)
- Mark Wielaard (mark@klomp.org)
URLDecoder
public URLDecoder()
Public contructor. Note that this class has only static methods.
decode
public static String decode(java.lang.String s)
This method translates the passed in string from x-www-form-urlencoded
format using the default encoding "UTF-8" to decode the hex encoded
unsafe characters.
Parameters:
Returns:
decode
public static String decode(java.lang.String s, java.lang.String encoding)
This method translates the passed in string from x-www-form-urlencoded
format using the given character encoding to decode the hex encoded
unsafe characters.
This implementation will decode the string even if it contains
unsafe characters (characters that should have been encoded) or if the
two characters following a % do not represent a hex encoded byte.
In those cases the unsafe character or the % character will be added
verbatim to the decoded result.
Since:Parameters:
Returns:
Throws:
This method is very useful for decoding strings sent to CGI scripts Written using on-line Java Platform 1.2/1.4 API Specification. Status: Believed complete and correct.