Re:Blink-dev – Intent to Ship: SharedArrayBuffer
by ygra on Friday April 07, 2017 @02:58AM
(#14057708)
atob/btoa is atrocious from an API design standpoint. Here we are, designing an API to convert things to Base64 and back and we use a string as a byte array substitute, nevermind the fact that strings are not limited to Latin-1. There's probably a bunch of libraries that solve this, but stumbling over this in a library that has no outside dependencies is a bit annoying since you have to solve it yourself ... again.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer
by IIIIIIIIIIII on Friday April 07, 2017 @03:53AM
(#14057938)
I'm just curious since I never used this feature, are you talking about this issue?
> The "Unicode Problem"
> Since DOMStrings are 16-bit-encoded strings, in most browsers calling window.btoa on a Unicode string will cause a Character Out Of Range exception if a character exceeds the range of a 8-bit ASCII-encoded character. There are two possible methods to solve this problem:
https://developer.mozilla.org/en/docs/Web/API/WindowBase64/B...
Other examples would be MD5 removed from subtlecrypto, killing any way to speak with services that use it for non-cryptographic operations, or the missing functions to encode/decode hex strings, which maybe are not everyday use cases but are provided by most languages and would need an afternoon to write with tests.
I want a better standard library. Just my discouraged 5 cents.