How to use the HTML Entity Encoder and Decoder.
Encoding and decoding depend on the destination context. Escaping HTML text is different from building a safe URL or JavaScript string.
Make the workflow fit your task.
Identify whether the destination is HTML text or an attribute, then encode the characters required for that context. For decoding, confirm that one decoding pass is intended. Preserve the original string to detect accidental double encoding.
- What you provide
- Text containing characters or entities.
- What you get
- Correctly escaped or decoded text.
See the input and the result.
Illustrative input and output · a teaching example, not a live WebAct run
Example input
Encode the text A & B for an HTML text node.
Completed example
A & B
Load this input into the prompt, then copy it to WebAct to try the task. Your result may differ from the illustration.
Decisions and troubleshooting.
Should an ampersand already inside an entity be encoded again?
Only if the literal entity text should be displayed. Otherwise repeated encoding can produce visible entity syntax instead of the intended character.
Why does decoded content become markup when inserted into a page?
Decoding can restore angle brackets. Insert ordinary text through a text API rather than treating it as trusted HTML.
Try it with your own source.
Replace the example with your material in the task prompt. Keep the requirements you need, then copy the task into WebAct.
Customize and copy the task ↑