diff --git a/encoding.bs b/encoding.bs index fe4e1a9..b19d150 100644 --- a/encoding.bs +++ b/encoding.bs @@ -1855,8 +1855,8 @@ TextEncoderStream includes GenericTransformStream;
encoder
An encoder instance. -
pending high surrogate -
Null or a surrogate, initially null. +
leading surrogate +
Null or a leading surrogate, initially null.

A {{TextEncoderStream}} object offers no label argument as it @@ -1974,26 +1974,26 @@ constructor steps are:

  1. -

    If encoder's pending high surrogate is non-null, then: +

    If encoder's leading surrogate is non-null, then:

      -
    1. Let high surrogate be encoder's pending high surrogate. +

    2. Let leadingSurrogate be encoder's leading surrogate. -

    3. Set encoder's pending high surrogate to null. +

    4. Set encoder's leading surrogate to null. -

    5. If item is in the range U+DC00 to U+DFFF, inclusive, then return a scalar value - whose value is 0x10000 + ((high surrogate − 0xD800) << 10) + - (item − 0xDC00). +

    6. If item is a trailing surrogate, then return a scalar value whose value + is + 0x10000 + ((leadingSurrogate − 0xD800) << 10) + (item − 0xDC00).

    7. Restore item to input.

    8. Return U+FFFD.

    -
  2. If item is in the range U+D800 to U+DBFF, inclusive, then set pending high - surrogate to item and return continue. +

  3. If item is a leading surrogate, then set leading surrogate to + item and return continue. -

  4. If item is in the range U+DC00 to U+DFFF, inclusive, then return U+FFFD. +

  5. If item is a trailing surrogate, then return U+FFFD.

  6. Return item.

@@ -2007,7 +2007,7 @@ that are split between strings. [[!INFRA]]
  1. -

    If encoder's pending high surrogate is non-null, then: +

    If encoder's leading surrogate is non-null, then:

    1. @@ -3322,7 +3322,7 @@ in deployed content. Therefore it is not part of the shared UTF-16 decoderdecode algorithm.

      shared UTF-16 decoder has an associated UTF-16 lead byte and -UTF-16 lead surrogate (both initially null), and +UTF-16 leading surrogate (both initially null), and is UTF-16BE decoder (initially false).

      shared UTF-16 decoder's handler, given ioQueue and @@ -3330,12 +3330,12 @@ rather the decode algorithm.

      1. If byte is end-of-queue and either - UTF-16 lead byte or UTF-16 lead surrogate is non-null, set - UTF-16 lead byte and UTF-16 lead surrogate to null, and return + UTF-16 lead byte or UTF-16 leading surrogate is non-null, set + UTF-16 lead byte and UTF-16 leading surrogate to null, and return error.

      2. If byte is end-of-queue and - UTF-16 lead byte and UTF-16 lead surrogate are null, return + UTF-16 lead byte and UTF-16 leading surrogate are null, return finished.

      3. If UTF-16 lead byte is null, set UTF-16 lead byte to @@ -3354,13 +3354,16 @@ rather the decode algorithm.

        Then set UTF-16 lead byte to null.

      4. -

        If UTF-16 lead surrogate is non-null, let lead surrogate be - UTF-16 lead surrogate, set UTF-16 lead surrogate to null, and then: +

        If UTF-16 leading surrogate is non-null:

          -
        1. If code unit is in the range U+DC00 to U+DFFF, inclusive, - return a code point whose value is - 0x10000 + ((lead surrogate − 0xD800) << 10) + (code unit − 0xDC00). +

        2. Let leadingSurrogate be UTF-16 leading surrogate. + +

        3. Set UTF-16 leading surrogate to null. + +

        4. If code unit is a trailing surrogate, then return a code point whose + value is + 0x10000 + ((leadingSurrogate − 0xD800) << 10) + (code unit − 0xDC00).

        5. Let byte1 be code unit >> 8. @@ -3371,16 +3374,12 @@ rather the decode algorithm. byte1.

        6. Restore bytes to ioQueue and return error. -

        -
      5. If code unit is in the range U+D800 to U+DBFF, inclusive, set - UTF-16 lead surrogate to code unit and return - continue. +

      6. If code unit is a leading surrogate, then set + UTF-16 leading surrogate to code unit and return continue. -

      7. If code unit is in the range U+DC00 to U+DFFF, inclusive, - return error. - +

      8. If code unit is a trailing surrogate, then return error.

      9. Return code point code unit.