Java tutorial
//package com.java2s; public class Main { /** * Converts the ampersand, quote, prime, less-than and greater-than * characters to their corresponding HTML entities in the given string. */ public static String htmlEntities(String text) { return text.replaceAll("&", "&").replaceAll("\"", """).replaceAll("'", "′") .replaceAll("<", "<").replaceAll(">", ">"); } }