W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2011

[whatwg] Specs for window.atob() and window.btoa()

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 04 Feb 2011 11:49:32 -0500
Message-ID: <4D4C2E1C.30703@mit.edu>
On 2/4/11 11:37 AM, Jorge wrote:
> Wrt to the note "some base64 encoders add newlines or other whitespace to their output. atob() throws an exception if its input contains characters other than +/=0-9A-Za-z, so other characters need to be removed before atob() is used for decoding" in http://aryeh.name/spec/base64.html , I think that in the end it's better to ignore any other chars instead of throwing, because skipping over any such chars while decoding is cheaper and requires less memory than scanning the input twice, first to clean it and second to decode it, something you'd not want to end up doing -just in case- everytime.

The problem is that at least some current browsers (which ones?) throw. 
  So you wouldn't be able to rely on the non-throwing behavior 
anyway....  :(

-Boris
Received on Friday, 4 February 2011 08:49:32 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:30 UTC