[whatwg] Character encoding of document.open()ed documents

Boris Zbarsky bzbarsky at MIT.EDU
Wed Mar 31 06:24:43 PDT 2010


On 3/31/10 7:12 AM, Henri Sivonen wrote:
> Currently, the spec says that document.open() sets the document's character encoding to UTF-16. This is what IE does except IE uses the label "unicode" instead of "UTF-16".
> Demo: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/438
>
> Gecko and WebKit set document's character encoding to UTF-8 even though the parser operates on UTF-16.
> Demo: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/439

Is that what Gecko does?  Or does it set the document's character 
encoding to the character encoding of the page that called open()?  I 
believe it's actually the latter.

> When loading external resources that don't have encoding labels, IE, Gecko and WebKit all use UTF-8 to decode the external resource.
> Demo: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/437

Again, UTF-8 or the encoding of the page that called open()?

> None of IE, WebKit or Opera let the meta charset in a document.open()ed document have any effect

As in, it doesn't affect how external resources with no encoding labels 
are handled?  Odd; I could have sworn it mattered in IE.  I distinctly 
recall Gecko having compat bugs of various sorts here for the external 
resource case at one point (as in, people reporting intranet apps and 
the like that worked in IE but not Gecko), and us trying pretty hard to 
fix them.

-Boris



More information about the whatwg mailing list