Re: Encoding and validation

Fri, 15 Jan 2010 17:32:44 -0500, /Bill Braun/:
> Stanimir Stamenkov wrote:
>
>> Saying all this, it seems your server is misconfigured to specify
>> UTF-8 encoding for this, all of this type, or all documents it
>> serves.  Your best bet is to fix up your server configuration.
>
> Thank you, Stanimir. Is the XML declaration necessary? I have no plans
> to actually use XML on any page on the site.

The XML declaration is optional but recommended:

http://www.w3.org/TR/xml/#dt-xmldecl

If your server configuration is to specify all the resources use
UTF-8 encoding, then even if you omit the XML declaration but
nevertheless encode your document differently (e.g. using
ISO-8859-1) the browser could fail to decode it.  It is a side
effect of ISO-8859-1 and UTF-8 sharing the common US-ASCII base,
that your document gets parsed o.k. - it just doesn't use non-ASCII
characters.

If you can't change your server configuration you better save your
document using UTF-8, which the server is configured to specify.
The issue is not specific to XML documents - you may check whether
your server is sending fixed UTF-8 for other documents, also.  It is
likely this problem will be most visible with XML documents because
decoding errors are treated as fatal errors:

http://www.w3.org/TR/xml/#dt-fatal

-- 
Stanimir

Received on Saturday, 16 January 2010 10:22:08 UTC