List of utility methods to do HTML Encode
String | htmlEncode(String str) html Encode if (str == null) { return ""; String tmp = str; tmp = replace(tmp, "&", "&", false); tmp = replace(tmp, "<", "<", false); tmp = replace(tmp, "\"", """, false); tmp = replace(tmp, ">", ">", false); ... |
String | htmlEncode(String str) Replaces the chars '>', '<', and '&' with the sequences '>', '<', and '&'. StringBuilder result = null; for (int i = 0, max = str.length(), delta = 0; i < max; i++) { char c = str.charAt(i); String replacement = null; if (c == '&') { replacement = "&"; } else if (c == '<') { replacement = "<"; ... |
String | htmlEncode(String string) Escapes all characters that may cause a problem if a string is used directly in HTML. StringBuilder sb = new StringBuilder(); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (c > 127 || c == '\"' || c == '\'' || c == '&' || c == '<' || c == '>' || c == '#' || c == ';') sb.append("&#").append((int) c).append(';'); else sb.append(c); return sb.toString(); |
String | HTMLEncode(String string) Encode a string to be displayed in HTML If fullHTML encode, then all unicode characters above 7 bits are converted into HTML entitites return HTMLEncode(string, false);
|
String | htmlEncode(String string) html Encode String encoded = replaceString(string, '&', "&"); encoded = replaceString(encoded, '<', "<"); return replaceString(encoded, '>', ">"); |
String | HtmlEncode(String strInput) Html Encode String input = strInput; input = nullToEmpty(input); if ("".equals(input)) { return " "; } else { input = Replace(input, "\"", """); input = Replace(input, "<", "<"); input = Replace(input, ">", ">"); ... |
String | htmlEncode(String strSrc) html Encode if (strSrc == null) return ""; char[] arr_cSrc = strSrc.toCharArray(); StringBuffer buf = new StringBuffer(arr_cSrc.length); char ch; for (int i = 0; i < arr_cSrc.length; i++) { ch = arr_cSrc[i]; if (ch == '<') ... |
String | htmlEncode(String strSrc) html Encode if (strSrc == null) { return ""; char[] arrCsrc = strSrc.toCharArray(); StringBuilder buf = new StringBuilder(arrCsrc.length); char ch; for (char anArrCSrc : arrCsrc) { ch = anArrCSrc; ... |
String | htmlEncode(String text) html Encode if (text == null || text.length() == 0) { return text; int length = text.length(); StringBuffer ret = new StringBuffer(length * 12 / 10); boolean isEncodeSpace = true; int last = 0; for (int i = 0; i < length; i++) { ... |
String | htmlEncode(String txt) Encodes the given text to HTML save form. if (txt == null) { return ""; return txt.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """) .replace("'", "'").replace("\r\n", "<br/>").replace("\n", "<br/>"); |