List of utility methods to do URL Decode
String | decode(String value, String charset) decode String decoded = null; try { decoded = URLDecoder.decode(value, charset); } catch (UnsupportedEncodingException e) { decoded = null; return decoded; |
String | decode(String value, String charset) decode String result = null; if (!isEmpty(value)) { try { result = URLDecoder.decode(value, charset); } catch (IOException e) { throw new RuntimeException(e); return result; |
String | decode(String value, String encoding) UnsupportedEncodingException -> value returns. String decode = null; try { decode = URLDecoder.decode(value, encoding); } catch (UnsupportedEncodingException e) { decode = value; return decode; |
String | decodeAjax(String value) decode Ajax String result = null; try { result = decode(value, UTF8); } catch (UnsupportedEncodingException e) { result = ""; e.printStackTrace(); return result; ... |
String | decodeAjaxParam(final String source) decode Ajax Param String target = source; try { target = (source == null ? source : URLDecoder.decode(source, ISO_8859_1)); } catch (final UnsupportedEncodingException ex) { return target; |
String[] | decodeArray(final String val) Return a StringArray resulting from decoding the given String which should have been encoded by encodeArray if (val == null) { return null; int len = val.length(); if (len == 0) { return new String[0]; ArrayList<String> al = new ArrayList<String>(); ... |
String | decodeCodedStr(String sourceStr, String targetCharset) decode Coded Str String decodedStr; String changedStr = changeCharset(sourceStr, targetCharset); if (changedStr != null) { try { decodedStr = URLDecoder.decode(URLDecoder.decode(changedStr, targetCharset), targetCharset); } catch (Exception e) { decodedStr = "unknown"; return decodedStr; return null; |
Map | decodeFormData(String formData) decode Form Data Map<String, String> decodedFormData = new HashMap<String, String>(); String[] pairs = formData.split("\\&"); for (int i = 0; i < pairs.length; i++) { String[] fields = pairs[i].split("="); String name = URLDecoder.decode(fields[0], "UTF-8"); String value = URLDecoder.decode(fields[1], "UTF-8"); decodedFormData.put(name, value); return decodedFormData; |
String | decodeHtmlString(String inputString) decode Html String String result; try { result = java.net.URLDecoder.decode(inputString, "UTF8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); result = ""; return result; ... |
String | decodeIfNeeded(String s) Unfortunately we have code that mindlessly decoded URLs (FileDownloadWindow) which borked (in the case I discovered) magnet uris with encoded parameters (e.g. if (s == null) { return (""); try { int q_pos = s.indexOf('?'); int a_pos = s.indexOf('&'); if (q_pos == -1 && a_pos == -1) { return (decode(s)); ... |