diff --git a/encoding.bs b/encoding.bs index f34ab30..ffe45fe 100644 --- a/encoding.bs +++ b/encoding.bs @@ -234,8 +234,8 @@ items, in the given order, before the first item in the queue. byte sequence input into an I/O queue, run these steps:
    -
  1. Assert: if input is a list, then it does not contain - end-of-queue. +

  2. Assert: input is not a list or it does not + contain end-of-queue.

  3. Return an I/O queue containing the items in input, in order, followed by end-of-queue. @@ -259,6 +259,21 @@ algorithms, as detailed in [[#implementation-considerations]]. 0x10000 + ((leading − 0xD800) << 10) + (trailing − 0xDC00). +


    + +
    +

    To create a Uint8Array object, given an I/O queue +ioQueue and a realm realm: + +

      +
    1. Let bytes be the result of converting + ioQueue into a byte sequence. + +

    2. Return the result of creating a {{Uint8Array}} object from + bytes in realm. +

    +
    +

    Encodings

    @@ -332,14 +347,14 @@ given an item item, encoding's I/O queue output, and error mode mode:
      -
    1. Assert: if encoderDecoder is an encoder instance, mode is - not "replacement". +

    2. Assert: encoderDecoder is not an encoder instance or + mode is not "replacement". -

    3. Assert: if encoderDecoder is a decoder instance, mode is - not "html". +

    4. Assert: encoderDecoder is not a decoder instance or + mode is not "html". -

    5. Assert: if encoderDecoder is an encoder instance, item is - not a surrogate. +

    6. Assert: encoderDecoder is not an encoder instance or + item is not a surrogate.

    7. Let result be the result of running encoderDecoder's handler on input and item. @@ -358,8 +373,8 @@ given an item item, encoding's

      Otherwise, if result is one or more items:

        -
      1. Assert: if encoderDecoder is a decoder instance, result - does not contain any surrogates. +

      2. Assert: encoderDecoder is not a decoder instance or + result does not contain any surrogates.

      3. Push result to output.

      @@ -1216,7 +1231,7 @@ is safe as it never triggers errors. [[HTML]] encoding encoding:
        -
      1. Assert: encoding is not replacement or UTF-16BE/LE. +

      2. Assert: encoding is not replacement or UTF-16BE/LE.

      3. Return an instance of encoding's encoder.

      @@ -1660,14 +1675,13 @@ constructor steps are to do nothing. "fatal".
    8. -

      Assert: result is not an error. +

      Assert: result is not an error.

      The UTF-8 encoder cannot return error. -

    9. If result is finished, then convert - output into a byte sequence and return a {{Uint8Array}} object wrapping an - {{ArrayBuffer}} containing output. - +

    10. If result is finished, then return the result of + creating a Uint8Array object given output and this's + relevant realm.

@@ -1898,8 +1912,9 @@ constructor steps are:
  • Let outputChunk be the result of running serialize I/O queue with decoder and output. -

  • If outputChunk is non-empty, then enqueue - outputChunk in decoder's transform. +

  • If outputChunk is not the empty string, then + enqueue outputChunk in decoder's + transform.

  • Return. @@ -1942,8 +1957,9 @@ steps:

  • Let outputChunk be the result of running serialize I/O queue with decoder and output. -

  • If outputChunk is non-empty, then enqueue - outputChunk in decoder's transform. +

  • If outputChunk is not the empty string, then + enqueue outputChunk in decoder's + transform.

  • Return. @@ -2067,11 +2083,11 @@ constructor steps are:

  • Convert output into a byte sequence.

  • -

    If output is non-empty: +

    If output is not empty:

      -
    1. Let chunk be a {{Uint8Array}} object wrapping an {{ArrayBuffer}} containing - output. +

    2. Let chunk be the result of creating a Uint8Array object + given output and encoder's relevant realm.

    3. Enqueue chunk into encoder's transform. @@ -2136,8 +2152,8 @@ that are split between strings. [[!INFRA]]

      1. -

        Let chunk be a {{Uint8Array}} object wrapping an {{ArrayBuffer}} containing - 0xEF 0xBF 0xBD. +

        Let chunk be the result of creating a Uint8Array object given + « 0xEF, 0xBF, 0xBD » and encoder's relevant realm.

        This is U+FFFD (�) in UTF-8 bytes.