jodd.servlet
Class HtmlEncoder

java.lang.Object
  extended by jodd.servlet.HtmlEncoder

public class HtmlEncoder
extends java.lang.Object

Encodes text and URL strings in various ways resulting HTML-safe text. All methods are null safe.


Field Summary
protected static char[][] BLOCK
           
protected static char[][] TEXT
           
 
Constructor Summary
HtmlEncoder()
           
 
Method Summary
static java.lang.String block(java.lang.String text)
          Encodes text into HTML-safe block preserving paragraphs.
static java.lang.String strict(java.lang.String text)
          Encodes text int HTML-safe block and preserves format using smart spaces.
static java.lang.String text(java.lang.String text)
          Encodes a string to HTML-safe text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT

protected static final char[][] TEXT

BLOCK

protected static final char[][] BLOCK
Constructor Detail

HtmlEncoder

public HtmlEncoder()
Method Detail

text

public static java.lang.String text(java.lang.String text)
Encodes a string to HTML-safe text. The following characters are replaced:

See Also:
block(String)

block

public static java.lang.String block(java.lang.String text)
Encodes text into HTML-safe block preserving paragraphs. Besides the default special characters the following are replaced, too:

Method accepts any of CR, LF, or CR+LF as a line terminator.


strict

public static java.lang.String strict(java.lang.String text)
Encodes text int HTML-safe block and preserves format using smart spaces. Additionally to block(String), the following characters are replaced:

This method preserves the format as much as possible, using the combination of not-breakable and common spaces.



Copyright © 2003-2012 Jodd Team