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

StringdecodeRfc5849(final String value)
Percent decodeRfc5849 the value as specified by the RFC5849 (3.6).
try {
    return URLDecoder.decode(value, UTF8);
} catch (UnsupportedEncodingException ex) {
    throw new AssertionError(ex); 
StringdecodeSpecialMdxCharactersInNames(String name)
decode Special Mdx Characters In Names
try {
    name = name.replace("XXX", "%");
    name = name.replace("YYY", ".");
    name = name.replace("ZZZ", "-");
    name = URLDecoder.decode(name, "UTF-8");
    return name;
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
...
StringdecodeStr(String str)
decode Str
try {
    str = URLDecoder.decode(str, ENCODE_CHARACTERSET);
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
return str;
StringdecodeString(String cookedTextString)
Decode URL-encoded text into a raw text string.
return URLDecoder.decode(cookedTextString, "UTF-8");
StringdecodeString(String myString)
decode String
if (myString == null) {
    throw new NullPointerException("decodeString: myString == null!");
try {
    return java.net.URLDecoder.decode(myString, "UTF-8");
} catch (UnsupportedEncodingException ex) {
    throw new AssertionError("UTF-8 not supported");
StringdecodeStringByUTF8(String str)
decode String By UTF
if (isBlank(str))
    return "";
try {
    return URLDecoder.decode(str, "utf-8");
} catch (UnsupportedEncodingException e) {
return "";
voiddecodeStringFields(Object objBean, String code)
decode String Fields
if (objBean == null) {
    return;
Field[] fields = objBean.getClass().getDeclaredFields();
String value = null;
Object objValue = null;
for (Field field : fields) {
    if (field.getType() == String.class) {
...
StringdecodeUTF8(String s)
string decoding is centralized at this method
if (s != null) {
    s = URLDecoder.decode(s, "UTF-8"); 
return s;
StringdecodeValue(String str)
Decode a string value from URL encoded value
try {
    return URLDecoder.decode(str, "UTF-8");
} catch (Exception e) {
    return str;
StringdecodeValue(String value)
decode Value
try {
    return URLDecoder.decode(value, "UTF-8").replaceAll("\\%20", " ").replaceAll("\\!", "\\%21") 
            .replaceAll("\\'", "\\%27") 
            .replaceAll("\\(", "\\%28").replaceAll("\\)", "\\%29").replaceAll("\\~", "\\%7E"); 
} catch (UnsupportedEncodingException e) {
    return value.replaceAll("\\%20", " ").replaceAll("\\!", "\\%21").replaceAll("\\'", "\\%27") 
            .replaceAll("\\(", "\\%28") 
            .replaceAll("\\)", "\\%29").replaceAll("\\~", "\\%7E"); 
...