spring-framework / org.springframework.web.util / HtmlUtils / htmlEscapeHex

htmlEscapeHex

open static fun htmlEscapeHex(input: String): 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 (&#xHex;).

Reference: http://www.w3.org/TR/html4/sgml/entities.html

Parameters

input - the (unescaped) input string

Return
the escaped string

open static fun htmlEscapeHex(input: String, encoding: String): 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 (&#xHex;) at least as required by the specified encoding. In other words, if a special character does not have to be escaped for the given encoding, it may not be.

Reference: http://www.w3.org/TR/html4/sgml/entities.html

Parameters

input - the (unescaped) input string

encoding - the name of a supported java.nio.charset.Charset

Return
the escaped string

Since
4.1.2