Re: [whatwg/encoding] TextEncoder#encode - write to existing Uint8Array (#69)

I wrote up a formal proposal at https://github.com/whatwg/encoding/pull/166 and some preliminary tests (that should be easy to add to) at https://github.com/web-platform-tests/wpt/pull/14505.

As I mentioned in the PR I've avoided the string view dictionary for now and you'll instead have to use substring or some such in JavaScript. If over time this turns out to be prohibitive we can quite easily overload the string argument with a string view dictionary.

I'm not requiring 3x string length as that seems unnecessarily constraining and might result in the caller having to jump through a lot of hoops (basically avoiding this API in a number of cases).

The result looks like reasonably idiomatic JavaScript so hopefully this is satisfactory to everyone as a v0 of this particular API.

Thanks to @maciejhirsz for raising this almost two-and-half years ago!

-- 
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-446984244

Received on Thursday, 13 December 2018 14:19:20 UTC