- java.lang.Object
-
- com.itextpdf.text.html.HtmlEncoder
-
public final class HtmlEncoder extends java.lang.ObjectThis class converts aStringto the HTML-format of a String.To convert the
String, each character is examined:- ASCII-characters from 000 till 031 are represented as &#xxx;
(with xxx = the value of the character) - ASCII-characters from 032 t/m 127 are represented by the character itself, except for:
- '\n' becomes <BR>\n
- " becomes "
- & becomes &
- < becomes <
- > becomes >
- ASCII-characters from 128 till 255 are represented as &#xxx;
(with xxx = the value of the character)
Example:
String htmlPresentation = HtmlEncoder.encode("Marie-Thérèse Sørensen");for more info: see O'Reilly; "HTML: The Definitive Guide" (page 164)
- Author:
- mario.maccarini@ugent.be
- ASCII-characters from 000 till 031 are represented as &#xxx;
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringencode(java.awt.Color color)Converts aColorinto a HTML representation of thisColor.static java.lang.Stringencode(java.lang.String string)Converts aStringto the HTML-format of thisString.static java.lang.StringgetAlignment(int alignment)Translates the alignment value.
-
-
-
Method Detail
-
encode
public static java.lang.String encode(java.lang.String string)
Converts aStringto the HTML-format of thisString.- Parameters:
string- TheStringto convert- Returns:
- a
String
-
encode
public static java.lang.String encode(java.awt.Color color)
Converts aColorinto a HTML representation of thisColor.- Parameters:
color- theColorthat has to be converted.- Returns:
- the HTML representation of this
Color
-
getAlignment
public static java.lang.String getAlignment(int alignment)
Translates the alignment value.- Parameters:
alignment- the alignment value- Returns:
- the translated value
-
-