/** * Unescape and decode a given string regarded as an escaped string with the * UTF-8 protocol charset. * @param escaped a string * @return the unescaped string * @throws IllegalStateException if the escaped string is not a correct URL */ public static String decode(String escaped) { byte[] asciiData = getAsciiBytes(escaped); byte[] rawdata; try { rawdata = URLCodec.decodeUrl(asciiData); } catch (DecoderException e) { throw new IllegalStateException(e.getMessage()); } return getString(rawdata, "UTF-8"); } }
/** * Unescape and decode a given string regarded as an escaped string with the * UTF-8 protocol charset. * @param escaped a string * @return the unescaped string * @throws IllegalStateException if the escaped string is not a correct URL */ public static String decode(String escaped) { byte[] asciiData = getAsciiBytes(escaped); byte[] rawdata; try { rawdata = URLCodec.decodeUrl(asciiData); } catch (DecoderException e) { throw new IllegalStateException(e.getMessage()); } return getString(rawdata, "UTF-8"); } }