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

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