encoding_decoding_html_entities
Encode special characters to HTML entities or decode entities back to characters to safely embed text in HTML/XML and prevent XSS attacks.
Instructions
Encode or Decode HTML Entities. Convert special characters to HTML entities and back so text is safe to embed in HTML/XML markup and to prevent XSS. Encoding replaces characters with named (<), decimal (<), or hex (<) entities; decoding resolves all three forms back to characters. Use this for HTML/XML markup safety; use encoding_decoding_url for URL percent-encoding, encoding_decoding_unicode for \u/\x source-code escapes, and encoding_decoding_string_escape for SQL/CSV/code string-literal quoting. Runs locally on the supplied text: read-only, non-destructive, offline, and rate-limited (60 requests/min anonymous). Returns the converted string plus a length and entity-count analysis.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to encode or decode. Required, non-empty. | |
| operation | Yes | encode converts characters to HTML entities; decode resolves named/decimal/hex entities back to characters. | |
| mode | No | Encode only. safe escapes < > & " only; all also escapes every non-ASCII character; extended escapes the common Latin-1, punctuation, and currency ranges. Ignored when decoding. | safe |
| format | No | Encode only. Output entity form: named (< with numeric fallback), decimal (<), or hex (<). Ignored when decoding. | named |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Whether the operation succeeded. | |
| input | No | The original text, echoed back. | |
| operation | No | The operation performed (encode or decode). | |
| mode | No | The encode mode used (safe, all, or extended). | |
| format | No | The encode output format used (named, decimal, or hex). | |
| result | No | The encoded or decoded output string. | |
| analysis | No | Length and entity-count metrics for the conversion. |