[whatwg] StringEncoding open issues

Glenn Maynard glenn at zewt.org
Fri Aug 17 07:15:50 PDT 2012


On Fri, Aug 17, 2012 at 2:23 AM, Jonas Sicking <jonas at sicking.cc> wrote:

> >       - If encoding is "utf-16" and the first bytes match 0xFF 0xFE or
> 0xFE
> >       0xFF then set current encoding to "utf-16" or "utf-16be"
> respectively and
> >       advance the stream past the BOM. The current encoding is used
> until the
> >       stream is reset.
> >       - Otherwise, if the first bytes match 0xFF 0xFE, 0xFE 0xFF, or 0xEF
> >       0xBB 0xBF then set current encoding to "utf-16", "utf-16be" or
> "utf-8"
> >       respectively and advance the stream past the BOM. The current
> encoding is
> >       used until the stream is reset.
>
> This doesn't sound right. The effect of the rules so far would be that
> if you create a decoder and specify "utf-16" as encoding, and the
> first bytes in the stream are 0xEF 0xBB 0xBF you'd silently switch to
> "utf-8" decoding.
>

I think the scope of the "otherwise" is unclear, and this is meant to be
"otherwise (if encoding is not "utf-16")".

-- 
Glenn Maynard



More information about the whatwg mailing list