diff --git a/encoding.bs b/encoding.bs index fe4e1a9..812821c 100644 --- a/encoding.bs +++ b/encoding.bs @@ -223,6 +223,12 @@ this restore operation is an internal detail of the algorithms in this specifica be used by other standards. Implementations are free to find alternative ways to implement such algorithms, as detailed in [[#implementation-considerations]]. +
To obtain a scalar value from surrogates, given a leading surrogate +leading and a trailing surrogate trailing, return +0x10000 + ((leading − 0xD800) << 10) + (trailing − 0xDC00). +
A {{TextEncoderStream}} object offers no label argument as it @@ -1974,26 +1980,26 @@ constructor steps are:
If encoder's pending high surrogate is non-null, then: +
If encoder's leading surrogate is non-null, then:
Let high surrogate be encoder's pending high surrogate. +
Let leadingSurrogate be encoder's + leading surrogate. -
Set encoder's pending high surrogate to null. +
Set encoder's leading surrogate to null. -
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). +
If item is a trailing surrogate, then return a + scalar value from surrogates given leadingSurrogate and item.
Restore item to input.
Return U+FFFD.
If item is in the range U+D800 to U+DBFF, inclusive, then set pending high - surrogate to item and return continue. +
If item is a leading surrogate, then set encoder's + leading surrogate to item and return continue. -
If item is in the range U+DC00 to U+DFFF, inclusive, then return U+FFFD. +
If item is a trailing surrogate, then return U+FFFD.
Return item.
If encoder's pending high surrogate is non-null, then: +
If encoder's leading surrogate is non-null, then:
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 +3336,12 @@ rather the decode algorithm.
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.
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.
If UTF-16 lead byte is null, set UTF-16 lead byte to @@ -3354,13 +3360,15 @@ rather the decode algorithm.
Then set UTF-16 lead byte to null.
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:
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). +
Let leadingSurrogate be UTF-16 leading surrogate. + +
Set UTF-16 leading surrogate to null. + +
If code unit is a trailing surrogate, then return a + scalar value from surrogates given leadingSurrogate and code unit.
Let byte1 be code unit >> 8. @@ -3371,16 +3379,12 @@ rather the decode algorithm. byte1.
If code unit is in the range U+D800 to U+DBFF, inclusive, set - UTF-16 lead surrogate to code unit and return - continue. +
If code unit is a leading surrogate, then set + UTF-16 leading surrogate to code unit and return continue. -
If code unit is in the range U+DC00 to U+DFFF, inclusive, - return error. - +
If code unit is a trailing surrogate, then return error.
Return code point code unit.