see whatever…

jump to menu

November 12, 2006

IE and apos character entity

Filed under: Markup,Web,XML — see @ 8:08 pm

I never thought about the character entity references too much. For XML I assumed at least the 5 predefined ones for character & <> ” and ‘. Naively I assumed this for HTML as well (plus the usual other ones used for years like entities for german umlauts etc).

But it seems I was wrong. ' which is the character entity for ‘ is only defined for XML but not HTML. It is used so seldom that it never struck me until I did some tests on IE 7 today. On my GIVE-A-WORD feature on my personal site I needed to escape ‘ as it is used in Javascript parts in element attributes which use ” as delimiter. So I had escaped ‘ with &apos; for quite some time now. It seems though that IE does not know this char ref and simple outputs the complete string… serving the exact same thing as application/xml does tickle IE into XML mode which then knows the ref. Really strange and unnecessary too. Solution would be to use a numeric reference, might do that or simple ignore this case which will happen rather seldom anyway.
For more details see e.g. http://lachy.id.au/log/2005/10/page/2/.

UPDATE:

Not easy to write this post in WordPress BTW, the HTML editor keeps changing the entities or does weird things with them…

1 Comment »

  1. *sigh* Ok, so we can’t fault IE for not sticking with the standards, but this is still quite frustrating. Thanks for helping point out that this bug does have a rhyme and reason.

    Comment by Marcos Kuhns — March 13, 2007 @ 3:41 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress