Re: [whatwg/encoding] Make TextEncoder and TextDecoder be transform streams (#127)

annevk commented on this pull request.



> @@ -1314,6 +1528,120 @@ must run these steps:
   </ol>
 </ol>
 
+<hr>
+
+<p>The <dfn id=concept-te-encode-and-enqueue>encode and enqueue a chunk</dfn> algorithm, given a
+{{TextEncoder}} <var>encForTransform</var> and <var>chunk</var>, runs these steps:
+
+<ol>
+ <li><p>Let <var>input</var> be the result of <a lt="converted to an IDL value">converting</a>
+ <var>chunk</var> to a {{DOMString}}. If this throws an exception, then return a promise rejected
+ with that exception.
+
+ <p class=note>{{DOMString}} is used here so that a surrogate pair that is split between chunks can
+ be correctly reassembled into the appropriate code point in the output. The behaviour is otherwise
+ identical to {{USVString}}. In particular, replacement characters will be used where necessary to
+ make the output valid UTF-8.

I'd prefer if we stated that lone surrogates will be replaced with U+FFFD.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/pull/127#pullrequestreview-106833889

Received on Monday, 26 March 2018 09:42:41 UTC