Check special characters before publishing a web page
A character can look right while carrying an unexpected code point. Review the text and its destination separately before you publish.
ON THIS PAGE
Start with the text you intend to publish
Consider this equipment note: “Keep 5 < 8 & leave a 2–3 mm gap.” The curly quotes and en dash are intentional; the less-than sign and ampersand should appear as text. Copy the sentence into Unicode Inspector to check the characters before putting it into your draft.
“Keep 5 < 8 & leave a 2–3 mm gap.”Inspect the differences that matter
| Text | Code point | Reason to check |
|---|---|---|
| “ and ” | U+201C and U+201D | These are curly quotes, rather than straight U+0022 quotation marks. |
| – | U+2013 | This is an en dash between 2 and 3, rather than U+002D hyphen-minus. |
| < and & | U+003C and U+0026 | These are visible text characters; their treatment depends on the publishing context. |
| Space between words | U+0020 | Check suspicious gaps instead of removing every invisible character. |
Check the part that is causing trouble. If a line refuses to wrap, compare the gap with a no-break space. If punctuation looks inconsistent, inspect those marks first. An unfamiliar code point is a reason to investigate, not a reason to replace every occurrence.
| What you notice | Check first | What to do next |
|---|---|---|
| The same text looks different after pasting | Copy it back and compare the code points. | If the sequence matches, check the destination font and text styling. |
| The draft shows & instead of & | Is the editor expecting plain text or HTML source? | Use the form that the field expects; decoding repeatedly can remove an intended layer. |
| A gap will not break across lines | Inspect the space at that exact position. | Keep a no-break space when it is intentional; otherwise replace only that gap. |
Read the actual code points and encoding counts.
Curly double quotesCompare the opening and closing characters.
Separate text from entity notation
An HTML entity spelling is a textual notation that an HTML parser can interpret. The character & and the five characters & are different strings before parsing. A plain-text field that stores & may simply display those five characters. Conversely, an HTML text node needs context-appropriate escaping when source text contains markup-significant characters.
“Keep 5 < 8 & leave a 2–3 mm gap.”Use the HTML Entity Converter to compare the two forms as text. For a step-by-step example, see converting HTML entities without running markup. The converter does not make a string safe for every HTML attribute, URL, script, or stylesheet; use your editor or framework’s method for the destination.
Compare encoded notation with decoded text without rendering markup.
Entity conversion documentationRead the converter’s supported forms and malformed-input feedback.
Test the destination as a reader
- Paste the intended plain text into a draft in the destination editor.
- Preview the actual web page with its intended font and a narrow viewport.
- Check that the words, quotes, gap, and comparison are visible as intended.
- Copy the questionable passage back into the inspector if the destination appears to alter it.
Keep a short before-and-after record for any replacement you choose. For this sample, replacing the en dash with a hyphen would be an editorial choice; encoding an ampersand for an HTML text context is a representation choice. Treating those as separate decisions makes it easier to explain a correction and to avoid a second accidental transformation.
Sources and method
- Unicode: UTF-8, UTF-16, UTF-32 and BOM — How code points are represented as encoding units and bytes.
- WHATWG HTML: Named character references — Authoritative named-reference mappings; GlyphIndex documents its own converter policy separately.
- Unicode: Characters and Combining Marks — Character sequences and displayed text elements are different concepts.