List of utility methods to do String Encode
String | encodeText(String str) encode string with RFC2047 try { return MimeUtility.encodeText(str, "utf-8", "B"); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); |
String | encodeText(String str, String fromEnc, String toEnc) Encode a string from the specific encoding name to other encoding name. return (str == null) ? null : new String(str.getBytes(fromEnc), toEnc); |
String | encodeTexts(String s) Encode non ascii characters present in email headers String ret = s; if (s != null) { try { ret = MimeUtility.encodeText(s, "ISO-8859-1", null); } catch (UnsupportedEncodingException e) { return ret; ... |
void | encodeTextValue(char[] characters, int offset, int length, Writer writer) encode Text Value for (int i = offset; i < offset + length; i++) { char c = characters[i]; switch (c) { case '<': writer.write(LT, 0, LT.length); break; case '>': writer.write(GT, 0, GT.length); ... |
String | encodeThoroughly(String s) encode Thoroughly String result; try { result = URLEncoder.encode(s, "UTF-8").replaceAll("\\+", "%20").replaceAll("\\%21", "!") .replaceAll("\\%27", "'").replaceAll("\\%28", "(").replaceAll("\\%29", ")") .replaceAll("\\%7E", "~"); } catch (UnsupportedEncodingException e) { result = s; return result; |
String | encodeToFlex(Object o) encode To Flex String url = java.net.URLEncoder.encode((String) o, "utf-8"); url = url.replaceAll("\\+", "%20"); return url; |
String | encodeToForm(Map msg) encode To Form StringBuffer sb = new StringBuffer(); String name; Object value; Iterator it = msg.keySet().iterator(); while (it.hasNext()) { name = (String) it.next(); value = URLEncoder.encode((String) msg.get(name)); sb.append(name + "=" + value); ... |
String | encodeToString(String s) encode To String try { return new String(encodeToChar(s.getBytes(ENCODING), false)); } catch (UnsupportedEncodingException ignore) { return null; |
String | encodeURNComponent(String value) Encode data to URN fragment. try { return URLEncoder.encode(value, "UTF-8").replace("+", "%20").replace("%21", "!").replace("%27", "\'") .replace("%28", "(").replace("%29", ")").replace("%7E", "~"); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); |
String | encodeUTF8(String input, boolean keepSpaces) Encod input as UTF-8 while converting %20 (space) to a space if (input == null) { return null; String encodedInput; try { encodedInput = URLEncoder.encode(input, UTF_8); } catch (UnsupportedEncodingException e) { return input; ... |