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

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