This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23093 - API: Need to reset BOM seen flag if streaming flag is unset when decode() called
Summary: API: Need to reset BOM seen flag if streaming flag is unset when decode() called
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: Encoding (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+encodingspec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-29 20:57 UTC by Joshua Bell
Modified: 2013-08-30 10:50 UTC (History)
1 user (show)

See Also:


Attachments

Description Joshua Bell 2013-08-29 20:57:26 UTC
The "BOM seen flag" is relevant to a single stream. Therefore it should be reset before decoding a new stream, e.g.

decoder = new TextDecoder('utf-8'); // BOM seen initially unset
decoder.decode(buffer1); // so unset when decode begins
decoder.decode(buffer2); // needs to be unset before this
decoder.decode(buffer3a, {stream: true}); // needs to be unset before this
decoder.decode(buffer3b); // but not before this

Step 1 for decode(input, options) should be changed from:

1. If the streaming flag is unset, set the encoding state to the default values of the encoding's decoder's associated variables and empty the stream.

to:

1. If the streaming flag is unset, set the encoding state to the default values of the encoding's decoder's associated variables, unset the BOM seen flag, and empty the stream.