Here you can find the source of quoteHTML(String string)
public static String quoteHTML(String string)
//package com.java2s; //License from project: Open Source License public class Main { public static String quoteHTML(String string) { if (string == null || string.length() == 0) { return "{}"; }//from w w w . j a v a 2 s . com char c = 0; int i; int len = string.length(); StringBuilder sb = new StringBuilder(len + 4); String t; for (i = 0; i < len; i += 1) { c = string.charAt(i); switch (c) { case '\\': sb.append("REPLACEKEY"); break; default: if (c < ' ') { t = "000" + Integer.toHexString(c); sb.append("\\u" + t.substring(t.length() - 4)); } else { sb.append(c); } } } String result = sb.toString().replaceAll("REPLACEKEYn", "<br />"); return result; } }