Package helma.util

# Class HtmlEncoder

java.lang.Object
helma.util.HtmlEncoder

public final class HtmlEncoder extends Object
This is a utility class to encode special characters and do formatting for HTML output.

## Constructor Summary

Constructors
Constructor
Description
`HtmlEncoder()`

## Method Summary

Modifier and Type
Method
Description
`static final String`
`encode(String str)`
Do "smart" encodging on a string.
`static final void`
`encode(String str, StringBuffer ret)`
Do "smart" encodging on a string.
`static final void`
`encode(String str, StringBuffer ret, boolean paragraphs, Set allowedTags)`
Do "smart" encodging on a string.
`static final String`
`encodeAll(String str)`
`static final void`
`encodeAll(String str, StringBuffer ret)`
`static final void`
`encodeAll(String str, StringBuffer ret, boolean encodeNewline)`
`static final String`
`encodeFormValue(String str)`
`static final void`
`encodeFormValue(String str, StringBuffer ret)`
`static final String`
`encodeXml(String str)`
`static final void`
`encodeXml(String str, StringBuffer ret)`
`static void`
`main(String[] args)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### HtmlEncoder

public HtmlEncoder()

## Method Details

### encode

public static final String encode(String str)
Do "smart" encodging on a string. This means that valid HTML entities and tags, Helma macros and HTML comments are passed through unescaped, while other occurrences of `<`, `>` and `&` are encoded to HTML entities.

### encode

public static final void encode(String str, StringBuffer ret)
Do "smart" encodging on a string. This means that valid HTML entities and tags, Helma macros and HTML comments are passed through unescaped, while other occurrences of `<`, `>` and `&` are encoded to HTML entities.

### encode

public static final void encode(String str, StringBuffer ret, boolean paragraphs, Set allowedTags)
Do "smart" encodging on a string. This means that valid HTML entities and tags, Helma macros and HTML comments are passed through unescaped, while other occurrences of `<`, `>` and `&` are encoded to HTML entities.

Parameters:
  `str` - the string to encode
  `ret` - the string buffer to encode to
  `paragraphs` - if true use p tags for paragraphs, otherwise just use br's
  `allowedTags` - a set containing the names of allowed tags as strings. All other tags will be escaped

### encodeFormValue

public static final String encodeFormValue(String str)

### encodeFormValue

public static final void encodeFormValue(String str, StringBuffer ret)

### encodeAll

public static final String encodeAll(String str)

### encodeAll

public static final void encodeAll(String str, StringBuffer ret)

### encodeAll

public static final void encodeAll(String str, StringBuffer ret, boolean encodeNewline)

### encodeXml

public static final String encodeXml(String str)

Parameters:
  `str` - ...
Returns:
  ...

### encodeXml

public static final void encodeXml(String str, StringBuffer ret)

Parameters:
  `str` - ...
  `ret` - ...

### main

public static void main(String[] args)