Keryx webb wrote:
xml-prologue

The XML Prologue is the section of the document that contains the XML
Declaration, DOCTYPE and any comments or PIs prior to the root element.
 The XML Declaration on the other hand, or (more specifically) the
encoding declaration within the XML declaration, is the special
construct that specifies the encoding and is what you're referring to.
Please try to get the terminology correct in future.

If a page is sent as XHTML, one could argue that it's supposed to be self-documenting, and that it might mean that the xml-prologue should be more important than the http-header.

See the Architecture of the WWW rec:
http://www.w3.org/TR/2004/REC-webarch-20041215/#xml-media-types

Information supplied at the protocol level always takes precedence over
anything specified in the file itself.  Therefore the HTTP Content-Type
header takes precedence over the XML declaration.

The precedence rules work like this for the following MIME types:

For application/xml, other application/*+xml
    and application/xml-external-parsed-entity:
1. charset parameter in the Content-Type header
2. BOM
3. The XML declaration
4. UTF-8

The meta element is never used for determining the encoding.

For external parsed entities, it uses the Text Declaration instead of the XML declaration. They're similar, but not exactly the same.

For text/xml and text/external-parsed-entity:
1. charset parameter in the Content-Type header
2. US-ASCII

The XML declaration and Text declaration is ignored.

For text/html:

a) According to the spec:
1. charset parameter in the Content-Type header
2. Meta element
3. charset attribute on the link followed to the page.

b) Actual browser implementation is a little unclear at this stage, it's not really well defined. Here's a rough overview anyway:
1. charset parameter in the Content-Type header
2. BOM
3. Meta element
4. Unspecified heuristics (guessing)
5. Default (according to browser pref, which is usually ISO-8859-1 or
   Windows-1252)

I'm not sure if any UAs actually support the charset attribute for links at all.

--
Lachlan Hunt
http://lachy.id.au/


******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************

Reply via email to