Re: [whatwg/encoding] Make decode() and encodeInto() accept SharedArrayBuffer-backed views (#172)

> applications that need string marshalling have to resort to a manual JS side implementation that loops and appends String.fromCharCode()s character by character:

[I see this is still the case](https://github.com/emscripten-core/emscripten/blob/c2b3c49f71ab98fbd9ff829d6cbd30445b56a93e/src/runtime_strings.js#L112-L134) but for what is worth it, [this is all it takes](https://github.com/WebReflection/coincident/blob/main/esm/index.js#L79) in my code to convert, I just use an `Uint16Array` view for the `SharedArrayBuffer` instead of *Uint8* and the `String.fromCharCode` accepts multiple arguments so that the dance can be *that* simple ... yet I agree if TextEncoder/Decoder would work out of the box I wouldn't need to also populate via manual `charCodeAt` operations the buffer in the first place.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/issues/172#issuecomment-1598320022
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/encoding/issues/172/1598320022@github.com>

Received on Tuesday, 20 June 2023 08:12:42 UTC