W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2015

Re: [XHR] UTF-16 - do content sniffing or not?

From: Simon Pieters <simonp@opera.com>
Date: Mon, 23 Mar 2015 13:45:05 +0100
To: "WebApps WG" <public-webapps@w3.org>, "Hallvord Reiar Michaelsen Steen" <hsteen@mozilla.com>
Message-ID: <op.xvya1fveidj3kv@simons-macbook-pro.local>
On Sun, 22 Mar 2015 23:13:20 +0100, Hallvord Reiar Michaelsen Steen  
<hsteen@mozilla.com> wrote:

> Hi,
> I've just added a test loading UTF-16 data with XHR, and it exposes an
> implementation difference that should probably be discussed:
>
> Given a server which sends UTF-16 data with a UTF-16 BOM but does *not*
> send "charset=UTF-16" in the Content-Type header - should the browser
> detect the encoding, or just assume UTF-8 and return mojibake-ish data?
>
> Per my test, Chrome detects the UTF-16 encoding while Gecko doesn't. I
> think the spec currently says one should assume UTF-8 encoding in this
> scenario. Are WebKit/Blink - developers OK with changing their
> implementation?
>
> (The test currently asserts detecting UTF-16 is correct, pending  
> discussion
> and clarification.)

What is your test doing? From what I understand of the spec, the result is  
different between e.g. responseText (honors utf-16 BOM) and JSON response  
(always decodes as utf-8).

-- 
Simon Pieters
Opera Software
Received on Monday, 23 March 2015 12:45:36 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:26 UTC