Java Utililty Methods URL Decode

List of utility methods to do URL Decode

Description

The list of methods to do URL Decode are organized into topic(s).

Method

voidaddParam(Map properties, String strParams, boolean bDecodeString)
Parse the param line and add it to this properties object.
int iIndex = strParams.indexOf('=');
int iEndIndex = strParams.length();
if (iIndex != -1) {
    String strParam = strParams.substring(0, iIndex);
    String strValue = strParams.substring(iIndex + 1, iEndIndex);
    if (bDecodeString) {
        try {
            strParam = URLDecoder.decode(strParam, URL_ENCODING);
...
Mapdecode(Map source, String encoding)
Decode all the keys and values based on the encoding.
try {
    Map<String, String[]> decoded = new HashMap<String, String[]>();
    for (Map.Entry<String, String[]> entry : source.entrySet()) {
        String key = URLDecoder.decode(entry.getKey(), encoding);
        String[] values = new String[entry.getValue().length];
        for (int i = 0; i < entry.getValue().length; i++) {
            values[i] = (entry.getValue()[i] == null) ? null
                    : URLDecoder.decode(entry.getValue()[i], encoding);
...
Stringdecode(final String content, final String encoding)
decode
try {
    return URLDecoder.decode(content, encoding != null ? encoding : "UTF-8");
} catch (UnsupportedEncodingException problem) {
    throw new IllegalArgumentException(problem);
Stringdecode(final String s, final String enc)
<#if locale="en">

Decode string with the encode character.

try {
    return URLDecoder.decode(s, enc);
} catch (final UnsupportedEncodingException e) {
    throw new RuntimeException(e);
Stringdecode(final String string)
URL decodes the specified string using the ISO-8859-1 encoding if applicable, otherwise the system default encoding will be used.
return decode(string, null);
Stringdecode(Object value)
Decodes string encoded in UTF-8 (useful for request parameters, or url fragments)
if (value == null) {
    return null;
try {
    return URLDecoder.decode(value.toString(), "UTF-8");
} catch (UnsupportedEncodingException e) {
    return null;
Stringdecode(String content)
decode
try {
    String decodeContent = URLDecoder.decode(content, "utf-8");
    return decodeContent;
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
return content;
Stringdecode(String encoded)
decode
String temp = URLDecoder.decode(encoded.toString(), "UTF-8");
if (temp.length() == encoded.length()) {
    return encoded;
} else {
    return temp;
Stringdecode(String encodeMsg)
decode
try {
    String transMsg = new String(encodeMsg.getBytes("ISO-8859-1"), "UTF-8");
    return java.net.URLDecoder.decode(transMsg, "UTF-8");
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
return null;
Stringdecode(String input)
decode
try {
    return URLDecoder.decode(input, systemEncoding);
} catch (UnsupportedEncodingException e) {
    throw new RuntimeException(e);