how is handling <?xml version="1.0" encoding="utf-8"?>
different to <?xml version="1.0"?>
It isn't. The default encoding is utf-8
, so including or omitting that part of the declaration makes no difference.
In any case when you are talking about browsers handling XHTML pages served as text/html
MIME type, the encoding in the XML Declaration is ignored; only the <meta>
tag (and, of course, the real HTTP header it is based on) has any effect. There is only a difference in browsers if you are serving them different types (eg. text/html
to IE and application/xhtml+xml
to the others). Don't do that.
Including the XML Declaration at all in an XHTML-as-HTML document causes IE6 to render the document in Quirks Mode, but that's fixed in later versions.
You should not include an XML Declaration in XHTML-as-HTML, and it's IMO of highly doubtful utility even in native XML, as the default version and encoding are almost always the values you want.