Blog

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
  1. Start with the text you intend to publish
  2. Inspect the differences that matter
  3. Separate text from entity notation
  4. Test the destination as a reader

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.

The curly quotation marks and en dash are intentional.
“Keep 5 < 8 & leave a 2–3 mm gap.”

Inspect the differences that matter

TextCode pointReason to check
“ and ”U+201C and U+201DThese are curly quotes, rather than straight U+0022 quotation marks.
–U+2013This is an en dash between 2 and 3, rather than U+002D hyphen-minus.
< and &U+003C and U+0026These are visible text characters; their treatment depends on the publishing context.
Space between wordsU+0020Check 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.

Start with the symptom rather than transforming the whole document.
What you noticeCheck firstWhat to do next
The same text looks different after pastingCopy it back and compare the code points.If the sequence matches, check the destination font and text styling.
The draft shows &amp; 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 linesInspect the space at that exact position.Keep a no-break space when it is intentional; otherwise replace only that gap.

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 &amp; are different strings before parsing. A plain-text field that stores &amp; may simply display those five characters. Conversely, an HTML text node needs context-appropriate escaping when source text contains markup-significant characters.

One valid HTML-reference spelling of the sample. This is source notation, not the plain-text sentence.
&ldquo;Keep 5 &lt; 8 &amp; leave a 2&ndash;3 mm gap.&rdquo;

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.

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

Copy manually

Couldn’t copy automatically. Select the text below and use your device’s Copy command.

Use your device’s Copy command, then paste the text where you need it.

Character details

Code points
UTF-8 bytes
View character details

Appearance can vary by font.

Your saved symbols

Save symbols for another visit in this browser. They won’t appear on your other devices or browser profiles.