Re: Encoding and validation

Fri, 15 Jan 2010 17:03:55 -0500, /Bill Braun/:
> Stanimir Stamenkov wrote:
> 
>> How do you serve the document to the validator - using file upload
>> or by providing an URL?
>
> By providing the URL.
>
>>> The character encoding specified in the HTTP header (utf-8) is
>>> different from the value in the XML declaration (iso-8859-1). I will
>>> use the value from the HTTP header (utf-8).
>>>
>>> What explains this, and how can the warning be cleared?
>>
>> I guess you're providing an URL to your document where the server is
>> sending a 'Content-Type' header including 'charset=utf-8' parameter.
>>  You should know the encoding specified in the HTTP communication
>> takes precedence over anything else.
>
> Inclusive of that, what changes would clear the warning?
> 
> I am out of my league here (understanding DOCTYPE and ?XML markup), so I
> might be missing the obvious.

The warning is because you've included an xml declaration stating
encoding different from what the HTTP headers say (ISO-8859-1 vs.
UTF-8).  Given that it is likely the browser could fail to parse
ISO-8859-1 encoded stream as UTF-8.  If your server is smart enough
to specify UTF-8 encoding for the file it serves, it should be smart
enough to rewrite the info in the xml declaration, then (re)encode
the stream appropriately.  If it is that smart, it should be able to
read the xml declaration and specify the encoding it gives in the
HTTP headers, and it won't need to re-encode the data.
Alternatively it shouldn't specify encoding information in the HTTP
headers leaving the parser to cope:

http://www.w3.org/TR/xml/#sec-guessing

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.

-- 
Stanimir

Received on Friday, 15 January 2010 22:22:11 UTC