List of utility methods to do HTML Encode
String | htmlEncode(String txt) html Encode if (null != txt) { txt = txt.replace("&", "&").replace("&amp;", "&").replace("&quot;", """) .replace("\"", """).replace("&lt;", "<").replace("<", "<") .replace("&gt;", ">").replace(">", ">").replace("&nbsp;", " "); return txt; |
String | htmlEncoded(String text) Substitutes conflicting characters in text with html masked expressions.
StringBuffer b; int i, len; char c; len = text.length(); b = new StringBuffer(len * 3); for (i = 0; i < len; i++) { c = text.charAt(i); switch (c) { ... |
String | htmlEncoder(String content) html Encoder content = content.replaceAll("\n", "<br>"); content = content.replaceAll("<", "<"); content = content.replaceAll(">", ">"); content = content.replaceAll(" ", " "); return content; |
String | htmlEncoding(String str) html Encoding StringBuffer bfu = new StringBuffer(); if (str != null) { String s = "&#"; char[] cs = str.toCharArray(); for (char c : cs) { int it = c; bfu.append(s).append(it).append(";"); return bfu.toString(); |
String | htmlEntityEncode(String s) Encodes given string with utf-8 encoding for html. StringBuffer buf = new StringBuffer(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9') { buf.append(c); } else { buf.append("&#" + (int) c + ";"); return buf.toString(); |
String | htmlize(CharSequence q) Return a string which represents a CharSequence in HTML.
StringBuilder sb = new StringBuilder(q.length() * 2); htmlize(q, sb); return sb.toString(); |
String | htmlize(String str) Surrounds string with html return "<html>" + str + "</html>"; |
String | htmlize(String text) htmlize if (text == null) return null; return text.replace(">", ">").replace("<", "<"); |
StringBuffer | htmlize(StringBuffer sb) ACME StringBuffer htmlizer. StringBuffer out = new StringBuffer(sb.length() + 100); out.insert(0, "<table border=\"1\"><tr><td>"); for (int i = 0; i < sb.length(); i++) { char c = sb.charAt(i); if (c == '\t') { out.append("</td><td>"); } else if (c == '\n') { out.append("</td></tr>\n<tr><td>"); ... |
String | htmlSpecialChars(String handleStr) htmlspecialchars, Change HTML special char in String return htmlSpecialChars(handleStr, true);
|