com.interface21.web.util
Class HtmlUtils

java.lang.Object
  |
  +--com.interface21.web.util.HtmlUtils

public abstract class HtmlUtils
extends java.lang.Object

Utility class for HTML escaping and unescaping. Based on code from com.purpletech.util.Utils, written by Alex Chaffee.

Reference: http://hotwired.lycos.com/webmonkey/reference/special_characters/

Since:
01.03.2003
Author:
Juergen Hoeller

Constructor Summary
HtmlUtils()
           
 
Method Summary
static java.lang.String htmlEscape(java.lang.String source)
          Turns funky characters into HTML entity equivalents. E.g.
static java.lang.String htmlUnescape(java.lang.String source)
          Reverses htmlEscape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlUtils

public HtmlUtils()
Method Detail

htmlEscape

public static java.lang.String htmlEscape(java.lang.String source)
Turns funky characters into HTML entity equivalents.

E.g. "bread" & "butter" => "bread" & "butter"

Update: supports nearly all HTML entities, including funky accents. See the source code for more detail.


htmlUnescape

public static java.lang.String htmlUnescape(java.lang.String source)
Reverses htmlEscape.


Rod Johnson and Spring contributors 2001-2003.