Scenario
A scraper returned Tom & Jerry <span>Sale Now</span> where the page showed "Tom & Jerry" and a styled sale banner. The content was HTML-escaped somewhere in the pipeline — every & became &, angle brackets became </>, and an invisible is hiding where a space should be. Before judging whether the scrape is correct, decode the entities so you are comparing text with text.
Broken input
Tom & Jerry <span>Sale Now</span>
Goal
Use HTML Entity Encoder / Decoder to turn the entities back into readable characters and reveal what the scraper actually captured — including whether those <span> tags are markup or escaped literal text.
Tool sequence
- Open HTML Entity Encoder / Decoder.
- Paste the scraped string and decode it once.
- Read the result:
Tom & Jerry <span>Sale Now</span>— the tags were escaped text in the source, meaning the scraper captured markup as content. - Watch the
: it decodes to a non-breaking space (U+00A0) that looks like a normal space but fails string comparisons; check it with ASCII / Unicode Explorer if downstream matching misbehaves. - Decide the fix at the pipeline level — either the scraper should unescape entities, or it should extract text content instead of inner HTML; re-scrape and confirm.
Checkpoint output
Tom & Jerry <span>Sale Now</span>
→ Tom & Jerry <span>Sale Now</span>
└── literal tag text, and "Sale Now" hides a U+00A0
One decode pass restores the ampersand, exposes the escaped <span> tags, and reveals the non-breaking space — three separate data issues from one glance.
Common mistakes
- Decoding entities and then injecting the result as trusted HTML — decoded
<span>from scraped content is an XSS vector if rendered. - Missing non-breaking spaces because they render exactly like regular spaces until an equality check fails.
- Encoding already-encoded text a second time, producing
&amp;chains that need multiple decode passes. - Decoding in a loop "until it stops changing," which corrupts legitimate text that mentions entities.
Related tools and lessons
- HTML Formatter - Format or minify HTML code.
- Markdown to HTML - Convert Markdown to HTML.
- ASCII / Unicode Explorer - Inspect characters, code points, bytes, and escapes.
- Related lesson: Make Minified HTML Readable Before Debugging
- Related lesson: Preview and Fix Markdown Before Publishing