- From: Henri Sivonen <notifications@github.com>
- Date: Thu, 01 Nov 2018 04:46:07 -0700
- To: whatwg/encoding <encoding@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 1 November 2018 11:46:29 UTC
So to suggest the interface for encoding from a `DOMString` into UTF-8 `Uint8Array`: ```webidl partial interface TextEncoder { TextEncoderEncodeIntoResult encodeInto(StringView source, Uint8Array destination, bool last); }; dictionary TextEncoderEncodeIntoResult { bool inputEmpty; // true if input was exhausted. false if more output space is needed unsigned long long read; // Number of UTF-16 code units read unsigned long long written; // Number of UTF-8 code units written }; dictionary StringView { DOMString str; unsigned long long start; // index of the first UTF-16 code unit that's logically part of the view unsigned long long length; // length of the view in UTF-16 code units }; ``` Unpaired surrogates are replaced with the REPLACEMENT CHARACTER. Unpairedness analysis is done on a per view basis (i.e. ending a `StringView` with an unpaired surrogate means an unpaired surrogate even if the surrogate is paired in the underlying `DOMString`). Output is filled as much as possible without splitting a UTF-8 sequence in output. -- 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/issues/69#issuecomment-435016213
Received on Thursday, 1 November 2018 11:46:29 UTC