Here you can find the source of unescapeHtml(String s)
public static String unescapeHtml(String s)
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w . j av a2s.c om * Reverses the escaping done by escapeForHtml. * This method is only meant to cope with HTML from escapeForHtml, not general HTML using arbitrary entities. * Unknown entities will be preserved. */ public static String unescapeHtml(String s) { final int sLength = s.length(); final StringBuilder result = new StringBuilder(sLength); for (int i = 0; i < sLength; ++i) { final char ch = s.charAt(i); if (ch == '&') { if (s.startsWith("&", i)) { result.append('&'); i += 4; } else if (s.startsWith(""", i)) { result.append('"'); i += 5; } else if (s.startsWith(">", i)) { result.append('>'); i += 3; } else if (s.startsWith("<", i)) { result.append('<'); i += 3; } else { // There are a lot of entities we don't know. Leave them unmolested. result.append(ch); } } else { result.append(ch); } } return result.toString(); } }