Java tutorial
//package com.java2s; public class Main { public static String htmlEscape(String html) { return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">") .replaceAll(" ", " ").replaceAll("'", "'").replaceAll("\"", """) .replaceAll("\n", "<br/>"); } }