W3C home > Mailing lists > Public > www-style@w3.org > December 2000

Re: CSS charset determination

From: Ian Graham <igraham@smaug.java.utoronto.ca>
Date: Sun, 3 Dec 2000 11:10:49 -0500
To: Bjoern Hoehrmann <derhoermi@gmx.net>
cc: www-style@w3.org
Message-ID: <Pine.SGI.4.05.10012031055210.165882-100000@smaug.java.utoronto.ca>

On Sat, 2 Dec 2000, Bjoern Hoehrmann wrote:

> Hi,
> http://www.w3.org/TR/REC-CSS2/syndata.html#q23 reads:
> [...]
> When a style sheet resides in a separate file, user agents must observe the
> following priorities when determining a document's character encoding (from
> highest priority to lowest):
>   * An HTTP "charset" parameter in a "Content-Type" field.
>   * The @charset at-rule.
>   * Mechanisms of the language of the referencing document
>     (e.g., in HTML, the "charset" attribute of the LINK element).
> [...]
> The lower precedence of the @charset rule stays in contradiction to XML and
> HTML where the charset is defined _in the document_, why?

The assumption with essentially all transport or message encoding
mechanisms (e.g. HTTP, MIME) is that, if the transport identifies
properties (MIME type, charset, etc.) of the message data, then these
should be considered the 'correct' properties for that data.  Equivalent
properties defined inside the data should only be used if there is no such
property set by the encoding or transport mechanism.

The XML and HTML specs don't really talk about transport, since they are
language and not transport specifications However, sections 4.3.3 of the
XML spec [1] and sections 5.2.2 of the HTML spec [2] discuss this, and not
that a charset specified in an HTTP header should have priority over any
value specificed as part of the document.

Of course, the real world is another matter. Some browsers (e.g., IE)
analyse the incoming data and override the HTTP-specifified content type
and charset, depending on what they sees in the incoming data.


[1] http://www.w3.org/TR/REC-xml
[2] http://www.w3.org/TR/html401/charset.html#doc-char-set
Ian Graham ......................... Centre for Academic Technology
i a n   d o t   g r a h a m    a t    u t o r o n t o   d o t   c a
..................... http://www.utoronto.ca/ian/ .................
Received on Sunday, 3 December 2000 11:10:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:56 UTC