How to Decode HTML Entities in Text
Enter non-empty HTML-encoded text, start HTML Decode, and review the returned character form. An empty input produces an unsuccessful result instead of decoded text.
What HTML Decode does
HTML entities represent characters in an encoded text form. HTML Decode converts supplied HTML-encoded text into the corresponding characters, so you can inspect the character form of a value that currently contains entity notation. This is useful when text has been copied from an HTML-related source and you need to see how its encoded characters decode.
The tool works with text input rather than treating the content as a full document. You can provide a single entity reference or a longer text value containing entity references. The operation is concerned with decoding entities in the supplied text. It does not establish that tags will be removed, that a complete document will become plain text, that markup will be sanitized, or that HTML will be validated.
How to decode HTML entities
- Open HTML Decode and locate its text input.
- Enter the HTML-encoded text you want to process. Include the surrounding text when you need to check how an entity appears in context. For example, you might enter a sentence containing
&rather than submitting only the entity reference. - Check the input before starting the operation. The text input is optional by contract, but decoding requires non-empty text. If the field is blank, add the value you want to inspect instead of running the operation with no text.
- Start the decoding operation with the available control.
- Review the returned outcome. A successful outcome contains text in which supplied HTML entities have been converted into their corresponding characters. Read the surrounding text as well, because the decoded character is part of the larger value you submitted.
- Compare the returned text with the source when you need to check a longer value. If the operation is unsuccessful, review the input and the outcome before trying again. An empty input is a documented cause of an unsuccessful result, and an exception during decoding can produce the same broad outcome.
- Use the returned character form for the next part of your task only after checking that it matches the context you intended to decode. Keep the source text available when you need to distinguish the encoded form from the decoded form.
How to read the result
A successful result indicates that the supplied text was processed and its HTML entities were decoded into corresponding characters. The result represents the text submitted for decoding; it is not a separate check of whether the surrounding content is valid HTML.
If the result is unsuccessful, first consider whether the text input was empty. Processing requires non-empty text, so add the encoded value and run the operation again. If the input was not empty, an exception during decoding is another documented boundary that can lead to an unsuccessful result. Review the returned outcome rather than assuming that the text was converted.
For a longer value, inspect both the converted characters and the text around them. A decoded character can be understood correctly only in relation to the surrounding text. Also keep the scope of the result in mind: decoding entities does not mean that HTML tags are removed, that a full HTML document is converted to plain text, that markup is sanitized, or that HTML is validated. Those are separate operations and are not established by this tool’s documented capability.
The most useful comparison is between the text before processing and the returned text afterward. This lets you identify which portions changed from entity notation to character form while preserving the context you supplied.
Worked example
A developer receives a sentence containing an HTML entity reference and needs to inspect its character form before using the text elsewhere.
Enter the non-empty text R&D uses & in encoded content, start HTML Decode, and inspect the returned text.
The result should indicate success and contain text in which the supplied HTML entities have been converted into their corresponding characters.
Limitations
- The documented capability is entity decoding in supplied text. It does not establish HTML tag removal, full-document conversion, markup sanitization, or HTML validation, and an exception during decoding returns an unsuccessful result.
Common errors
- Cause: the text input is empty. Correction: enter non-empty HTML-encoded text before starting the operation, because an empty input returns an unsuccessful result instead of decoded text.
FAQ
What happens when the HTML Decode input is empty?
When the text input is empty, the operation returns an unsuccessful result rather than decoded text. Enter non-empty HTML-encoded text and run the operation again.
Does HTML Decode remove HTML tags?
HTML Decode processes supplied HTML-encoded text into corresponding characters. It does not remove HTML tags, convert a full HTML document to plain text, sanitize markup, or validate HTML.
What if decoding does not succeed?
When an exception occurs during decoding, the computation returns an unsuccessful result. Check the supplied text and review the returned outcome.