[thelist] Doctypes, xml declarations and charsets

Jim Dabell jim-lists.evolt.org at jimdabell.com
Wed Nov 13 13:47:01 CST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Monday 11 November 2002 5:58 pm, Peter-Paul Koch wrote:
> >I read that <?xml.... declarations for charset at the start of an xhtml
> >doc can cause problems so I've not been using it, just this:
> >
> ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> >     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> ><html xmlns="http://www.w3.org/1999/xhtml">
> ><head>
> ><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> >
> >
> >Can anyone enlighten me on what problems i might cause with which
> >browsers by using an xml declaration?
>
> IE6 will go back to Quirks mode, even if the doctype would switch it to
> standards mode.

Also, a couple of obscure user-agents will render it as content (pocket ie,
ie2, one other that I forget).


> >conversely:
> >What problems might I cause by not using one?
>
> IE6 in Standards Mode <g>.

:)

The rules of xml, xhtml and http are suitably confusing regarding character
encoding, and I believe they even changed fairly recently.  I can't
remember the details, but as long as you stick to utf-8 declared in your
http headers, and also specify it in your head element, you aren't going
wrong to omit the xml declaration (I chose a decent implementation, and
stuck to it, much easier than keeping track of it all).  Of course, that
may be no use if you have to use something other than utf-8, so some
careful research on character encodings would be in order.

- --
Jim Dabell


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE90qk33tJNldoQhi8RAkSPAKCySYxE28K1ISqt+y/oMz79e16NBwCgr8dJ
UDmHFj74gY/DqAA3SQC0K7M=
=4t3m
-----END PGP SIGNATURE-----




More information about the thelist mailing list