freecoding.school100% FREE · NO SIGNUP
The Old NetISSUE #21 of 60

character entities in xhtml

Pixel PeteVSQuirks Mode
Pixel Pete saysIn XHTML, named HTML entities beyond the basics need care — XML only predefines five.

XML predefines only &, <, >, ", '. Other named entities like   and © depend on the DTD being loaded — fragile in pure XML mode. The safe path is numeric character references ( ) or, with UTF-8, the literal character.

Power-ups you unlock

Quirks Mode attacks — common mistakes

Boss battleReplace   with a reference that works in strict XML mode.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>risky in XML:  &amp;nbsp;
safe numeric:  &amp;#160;
safe literal:  (a real non-breaking space, utf-8)</pre></body></html>
▶ Open the interactive comic issue
‹ Xml Stylesheets · Linking XsltWhy Html5 Won · Pragmatism Over Purity ›