Charset (Was: [Javascript] JS Marquee - Advanced!)

tedd tedd at
Sun Aug 13 14:55:00 CDT 2006

At 2:01 PM -0500 8/13/06, Scott Reynen wrote:
>On Aug 13, 2006, at 12:30 PM, Troy III Ajnej wrote:
>>Try, view, source of the same document or
>>and see if you can find the charset meta anywhere.
>>Since you will not... -there isn't one!

See below:

>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 
>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.


Good points.

I can't speak for Rasmus, but his is what he said to me about that.

I asked:

>Ok, but why doesn't w3c use it?
>   (check source)
>I'm not sure what to do re charset. I've been told by credible 
>sources to "always use it" and "never use it" -- which is correct? 
>Or, is this one of those "it depends" things?

Rasmus replied:

--- quote ---

W3C is all about standards.  IE is all about not following standards. 
If you want your site to work in the real world you should always set 
a charset.  If you set it in your response header there is no need to 
set it in each page, and if you look closely, you will see that this 
is what is doing:

9:55am shiny:~> telnet 80
Connected to
Escape character is '^]'.

HTTP/1.1 200 OK
Date: Sun, 13 Aug 2006 18:42:15 GMT
Server: Apache/2.0.54 (Debian GNU/Linux) mod_perl/1.999.21 Perl/v5.8.4
Accept-Ranges: bytes
Connection: close
Content-Type: text/html; charset=utf-8


--- un-quote ---




More information about the Javascript mailing list