public static String decode(String encodedValue,final String encoding){
  try {
    if (encodedValue != null) {
      String previousEncodedValue;
      do {
        previousEncodedValue=encodedValue;
        encodedValue=URLDecoder.decode(encodedValue,encoding);
      }
 while (!encodedValue.equals(previousEncodedValue));
    }
    return encodedValue;
  }
 catch (  UnsupportedEncodingException ignore) {
    return encodedValue;
  }
}

public static String decode ( String encodedValue , final String encoding ) { try { if ( encodedValue != null ) { String previousEncodedValue ; do { previousEncodedValue = encodedValue ; encodedValue = URLDecoder . decode ( encodedValue , encoding ) ; } while ( ! encodedValue . equals ( previousEncodedValue ) ) ; } return encodedValue ; } catch ( UnsupportedEncodingException ignore ) { return encodedValue ; } }
decodes the encoded string value using the specified encoding ( such as utf - 8 ) . it is assumed the string value was encoded with the urlencoder using the specified encoding . this method handles unsupportedencodingexception by just returning the encodedvalue . since it is possible for a string value to have been encoded multiple times , the string value is decoded until the value stops changing ( in other words , until the value is completely decoded ) . < p / >
