java.lang.Object | |
↳ | org.springframework.web.util.HtmlUtils |
Utility class for HTML escaping. Escapes and unescapes based on the W3C HTML 4.01 recommendation, handling character entity references.
Reference: http://www.w3.org/TR/html4/charset.html
For a comprehensive set of String escaping utilities, consider Jakarta Commons Lang and its StringEscapeUtils class. We are not using that class here to avoid a runtime dependency on Commons Lang just for HTML escaping. Furthermore, Spring's HTML escaping is more flexible and 100% HTML 4.0 compliant.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Turn special characters into HTML character references.
| |||||||||||
Turn special characters into HTML character references.
| |||||||||||
Turn special characters into HTML character references.
| |||||||||||
Turn HTML character references into their plain text UNICODE equivalent.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Turn special characters into HTML character references. Handles complete character set defined in HTML 4.01 recommendation.
Escapes all special characters to their corresponding
entity reference (e.g. <
).
input | the (unescaped) input string |
---|
Turn special characters into HTML character references. Handles complete character set defined in HTML 4.01 recommendation.
Escapes all special characters to their corresponding numeric reference in decimal format (Decimal;).
input | the (unescaped) input string |
---|
Turn special characters into HTML character references. Handles complete character set defined in HTML 4.01 recommendation.
Escapes all special characters to their corresponding numeric reference in hex format (Hex;).
input | the (unescaped) input string |
---|
Turn HTML character references into their plain text UNICODE equivalent.
Handles complete character set defined in HTML 4.01 recommendation and all reference types (decimal, hex, and entity).
Correctly converts the following formats:
&#Entity; - (Example: &) case sensitive &#Decimal; - (Example: D)Gracefully handles malformed character references by copying original characters as is when encountered.
&#xHex; - (Example: å) case insensitive
input | the (escaped) input string |
---|