List of utility methods to do URL Encode
String | encode(Properties prop) encode try { StringBuffer sb = new StringBuffer(); Enumeration e = prop.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); String value = prop.getProperty(key); String ekey = URLEncoder.encode(key, "utf-8"); String evalue = URLEncoder.encode(value, "utf-8"); ... |
String | encode(String _string, String _sEncoding) Encodes the string into URL format. try { return URLEncoder.encode(_string, _sEncoding); } catch (Exception ex) { throw new RuntimeException("failed to encode string into URL format using encoding " + _sEncoding, ex); |
String | encode(String from, String to, String word) encode return String.format(Locale.UK, "https://translate.googleapis.com/translate_a/single?client=gtx&sl=%s&tl=%s&dt=t&q=%s", from, to, URLEncoder.encode(word)); |
String | encode(String in) encode try { return URLEncoder.encode(in, "UTF-8").replace("+", "%20").replace("*", "%2A").replace("%7E", "~"); } catch (Exception wontHappen) { return null; |
String | encode(String input) encode try { return URLEncoder.encode(input, systemEncoding).replace("+", "%20"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); |
String | encode(String input) * Returns a URL encoded String obtained from input, which is assumed to be a String composed of characters in the default charset. String encoded = input; try { encoded = URLEncoder.encode(input, getCharset()); } catch (Exception ex) { ex.printStackTrace(); return encoded; |
String | encode(String raw) Encode the message by replacing all the white spaces with %20. String encoded = null; try { encoded = URLEncoder.encode(raw.replaceAll(" ", "%20"), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return encoded; |
String | encode(String s) encode String ret = s; try { ret = URLEncoder.encode(s.trim(), "UTF-8"); } catch (Exception localException) { return ret; |
String | encode(String s) URL encodes the specified string using the UTF-8 character encoding. try { return (s != null) ? URLEncoder.encode(s, "UTF-8") : null; } catch (UnsupportedEncodingException uee) { throw new RuntimeException("UTF-8 is unknown in this Java."); |
String | encode(String s) Translates a string into x-www-form-urlencoded format.
final StringBuffer out = new StringBuffer(s.length()); final ByteArrayOutputStream buf = new ByteArrayOutputStream(32); final OutputStreamWriter writer = new OutputStreamWriter(buf); for (int i = 0; i < s.length(); i++) { int c = s.charAt(i); if (charactersDontNeedingEncoding.get(c)) { out.append((char) c); } else { ... |