W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2013

Re: [whatwg] BinaryEncoding for Typed Arrays using window.btoa and window.atob

From: Chang Shu <cshu01@gmail.com>
Date: Tue, 6 Aug 2013 16:48:28 -0400
Message-ID: <CAMtH1gBRW-PBjWgPmJYvD3dodg+g6gZNyHEvnS=m9xrJFw0B1g@mail.gmail.com>
To: Kornel Lesiński <kornel@geekhood.net>
Cc: whatwg@lists.whatwg.org
If technically no benefit of passing ArrayBufferView as a 2nd
parameter to atob, I think returning an ArrayBuffer is a good way to
go. Enhancing btoa/atob would be an easy solution while I am open to
enhance the Encoding spec. But it appears to me we have to introduce
another pair of coders, say BinaryDecoder/BinaryEncoder, in addition
to TextDecoder/TextEncode since the signatures of the decode/encode
functions are different.

Chang

On Tue, Aug 6, 2013 at 8:28 AM, Kornel Lesiński <kornel@geekhood.net> wrote:
> On Mon, 05 Aug 2013 21:39:22 +0100, Chang Shu <cshu01@gmail.com> wrote:
>
>> I see your point now, Simon. Technically both approaches should work.
>> As you said, yours has the limitation that the implementation does not
>> know which view to return unless you provide an enum type of parameter
>> instead of boolean to atob.
>
>
> In that case it'd be better to return ArrayBuffer, so the user can wrap it
> in any type they want (including DataView).
>
> --
> regards, Kornel
Received on Tuesday, 6 August 2013 20:48:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:23 UTC