[whatwg] Specs for window.atob() and window.btoa()
bzbarsky at MIT.EDU
Fri Feb 4 08:49:32 PST 2011
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
More information about the whatwg