<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23093</bug_id>
          
          <creation_ts>2013-08-29 20:57:26 +0000</creation_ts>
          <short_desc>API: Need to reset BOM seen flag if streaming flag is unset when decode() called</short_desc>
          <delta_ts>2013-08-30 10:50:22 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>Encoding</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joshua Bell">jsbell</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>mike</cc>
          
          <qa_contact>sideshowbarker+encodingspec</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>92708</commentid>
    <comment_count>0</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2013-08-29 20:57:26 +0000</bug_when>
    <thetext>The &quot;BOM seen flag&quot; is relevant to a single stream. Therefore it should be reset before decoding a new stream, e.g.

decoder = new TextDecoder(&apos;utf-8&apos;); // 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&apos;s decoder&apos;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&apos;s decoder&apos;s associated variables, unset the BOM seen flag, and empty the stream.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92735</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-08-30 10:50:22 +0000</bug_when>
    <thetext>https://github.com/whatwg/encoding/commit/01f872bf168e138533d5aa67405d358f8c2fdc94</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>