[thelist] using character entities

Simon Willison cs1spw at bath.ac.uk
Mon Nov 3 13:46:53 CST 2003


Tom Dell'Aringa wrote:
> Just working on my HTML guidelines doc again for my department. I'm
> on HTML character entities, and I'm trying to explain the reason why
> you should use them (we are generally using XHTML transitional) in
> our pages.
> 
> I've been using them long enough, but for some reason I cannot come
> up with the reason why. Sure, pages won't validate is a partial
> reason, but not really a good one and not one that will be accepted
> here. I feel as though I am missing the obvious but can't think of
> it...

If you're using XHTML transitional, your pages should be well-formed 
XML. The principle reason for using XHTML is that documents are XML and 
can thus be processed using XML tools (such as XPath and XSLT) - if your 
documents don't use HTML entities they won't be valid XML and the 
advantage of using XHTML is lost.

Also, using entities garauntees compatibility with browsers and other 
user agents. Most browsers attempt to emulate IE's highly forgiving 
parsing of incorrect entities but since it's not part of any standard 
there's no garauntee that all browsers will get it right.

-- 
Simon Willison
Web development weblog: http://simon.incutio.com/



More information about the thelist mailing list