encodeHtml
function encodeHtml(value: string): string;
Unlike escapeHtml, which touches only the five dangerous characters, this rewrites the whole string as &#NN; references. decodeHtml is its inverse.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The string to convert. It must not be empty. |
Returns
string — the encoded string.
Throws
Exception | Condition |
|---|---|
| the value is not a string, or is empty. |
Examples
Converting
encodeHtml("<a>"); // => "<a>"
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.