public static String encodeHTML(String plainText) {
	    StringBuffer out = new StringBuffer();
	    for(int i=0; i<plainText.length(); i++) {
	        char c = plainText.charAt(i);
	        if(c > 127 || c=='"' || c=='<' || c=='>') {
	           out.append("&#"+(int)c+";");
	        }
	        else {
	            out.append(c);
	        }
	    }
	    return out.toString().replaceAll("(\r\n|\n)", "<br />");
	}