Charset (Was: [Javascript] JS Marquee - Advanced!)
Scott Reynen
scott at randomchaos.com
Sun Aug 13 14:01:50 CDT 2006
On Aug 13, 2006, at 12:30 PM, Troy III Ajnej wrote:
> Try, view, source of the same document or
> http://validator.w3.org
> and see if you can find the charset meta anywhere.
> Since you will not... -there isn't one!
I might be missing the point here, but the lack of a charset in the
source doesn't mean the document has no stated charset. If you look
at the headers for that document, you'll see the charset is stated
there:
Content-Type: text/html; charset=utf-8
Before the document is sent, which is ideal if you have such control
over headers, but not everyone does, hence the <meta> option.
> The charset encoding depends on your choice while first naming and
> saving your
> document from your chosen editor, not on your meta description.
> The browser might take you for your word and try to read/render the
> document
> according to your wrong description. But most browsers are smart
> and the first
> encountered mismatch they fallback to auto-detection and re-read
> the content using
> the correct encoding/decoding scheme.
Potential discrepancy between the actual and stated charset is a not
a good reason to avoid stating a charset, rather it's a good reason
to take care to state the correct, actual charset. User agents can't
be assumed to reliably auto-detect. Not only do some not even try,
but those that do can't possibly auto-detect everything due to
overlapping code ranges. Auto-detection is an imperfect guessing
game, which I assume is what Rasmus was saying. That he conflated
stated and actual charset doesn't make it any less important to
explicitly state charset.
Peace,
Scott
More information about the Javascript
mailing list