Character references in HTML and XML

To find out everything you need to know about numeric character references and character entity references in HTML and XML, read Lachlan Hunt’s article Character References Explained.

The conclusion is that if you use character entity references such as – in HTML documents, they work fine. If the same documents are then converted to XHTML and sent as application/xhtml+xml, there is no guarantee that the character entity references will continue to work.

Some browsers include a pseudo-DTD catalog which contain the character entity references, letting the browser display them as if the document was HTML. Other browsers will simply omit character entity references other than the five that are pre-defined in XML.

The safest is to use numeric character references.

Posted on October 23, 2005 in (X)HTML