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

2011-12-14 Thread Ian Hickson
On Fri, 13 May 2011, Simon Pieters wrote: We're making this change in Opera (we'll ignore space characters in atob). I've updated the spec accordingly. Let me know if this causes any problems. -- Ian Hickson U+1047E)\._.,--,'``.fL http://ln.hixie.ch/

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

2011-05-13 Thread Simon Pieters
On Thu, 12 May 2011 00:13:37 +0200, Ian Hickson i...@hixie.ch wrote: On Fri, 4 Feb 2011, 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

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

2011-05-11 Thread Ian Hickson
On Fri, 4 Feb 2011, 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

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

2011-02-05 Thread Aryeh Gregor
On Fri, Feb 4, 2011 at 6:59 PM, Simon Pieters sim...@opera.com wrote: Is the compat problem for not throwing for whitespace or for not throwing for other garbage? If it's for other garbage, we could allow whitespace but throw for other garbage. (The bugs I can find in our database with a quick

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

2011-02-05 Thread Jonas Sicking
On Sat, Feb 5, 2011 at 4:29 PM, Aryeh Gregor simetrical+...@gmail.com wrote: On Fri, Feb 4, 2011 at 6:59 PM, Simon Pieters sim...@opera.com wrote: Is the compat problem for not throwing for whitespace or for not throwing for other garbage? If it's for other garbage, we could allow whitespace

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

2011-02-05 Thread Joshua Cranmer
On 02/05/2011 08:29 PM, Jonas Sicking wrote: So my first question is, can someone give examples of sources of base64 data which contains whitespace? The best guess I have is base64-encoding MIME parts, which would be hardwrapped every 70-80 characters or so. -- Beware of bugs in the above

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

2011-02-05 Thread Joshua Bell
On Sat, Feb 5, 2011 at 6:37 PM, Joshua Cranmer pidgeo...@verizon.netwrote: On 02/05/2011 08:29 PM, Jonas Sicking wrote: So my first question is, can someone give examples of sources of base64 data which contains whitespace? The best guess I have is base64-encoding MIME parts, which would be

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

2011-02-04 Thread Boris Zbarsky
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

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

2011-02-04 Thread Aryeh Gregor
On Fri, Feb 4, 2011 at 11:49 AM, Boris Zbarsky bzbar...@mit.edu wrote: 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  :( Everyone except Opera throws on invalid characters in atob() input, and

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

2011-02-04 Thread Jonas Sicking
On Fri, Feb 4, 2011 at 8:37 AM, Jorge jo...@jorgechamorro.com wrote: Hi, 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

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

2011-02-04 Thread Jorge
On 04/02/2011, at 17:49, Boris Zbarsky wrote: 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

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

2011-02-04 Thread Jorge
On 04/02/2011, at 18:58, Jonas Sicking wrote: On Fri, Feb 4, 2011 at 8:37 AM, Jorge jo...@jorgechamorro.com wrote: Hi, 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

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

2011-02-04 Thread Aryeh Gregor
On Fri, Feb 4, 2011 at 1:19 PM, Jorge jo...@jorgechamorro.com wrote: On the other hand, it will be so forever Correct, it will be. unless the spec says *not* to throw but to skip over instead, so that in a few years the cleanup can be ~safely skipped. Nope. The spec isn't going to change

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

2011-02-04 Thread Jorge
On 04/02/2011, at 19:54, Aryeh Gregor wrote: On Fri, Feb 4, 2011 at 1:19 PM, Jorge jo...@jorgechamorro.com wrote: unless the spec says *not* to throw but to skip over instead, so that in a few years the cleanup can be ~safely skipped. Nope. The spec isn't going to change browser behavior

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

2011-02-04 Thread Simon Pieters
On Fri, 04 Feb 2011 19:54:56 +0100, Aryeh Gregor simetrical+...@gmail.com wrote: On Fri, Feb 4, 2011 at 1:19 PM, Jorge jo...@jorgechamorro.com wrote: On the other hand, it will be so forever Correct, it will be. unless the spec says *not* to throw but to skip over instead, so that in a

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

2011-02-01 Thread Ian Hickson
On Wed, 25 Aug 2010, Boris Zbarsky wrote: On 8/25/10 9:37 PM, Boris Zbarsky wrote: Note that this issue means that using atob or btoa for dealing with this is a huge pain if non-ASCII chars are involved, since those take and return byte arrays masquerading as JS strings, not actual

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

2011-01-09 Thread Aryeh Gregor
On Fri, Jan 7, 2011 at 12:38 PM, Boris Zbarsky bzbar...@mit.edu wrote: In that case, I would prefer that the character and length constraints just be explicitly specified.  Specifying them via an unreadable regexp is hostile not just to implementors but to the users of the spec too. I've

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

2011-01-07 Thread Aryeh Gregor
On Fri, Jan 7, 2011 at 12:01 AM, Boris Zbarsky bzbar...@mit.edu wrote: For what it's worth, Firefox's behavior for atob (based on reading the source code, sorta) is the following (ignoring various exceptions on allocation failures and the like): 1)  If the input string contains any 16-bit

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

2011-01-07 Thread Boris Zbarsky
On 1/7/11 12:27 PM, Aryeh Gregor wrote: 1) If the input string contains any 16-bit units whose value is greater than 0xff, throw INVALID_CHARACTER_ERR. This seems redundant with step 4 below. It's not, because after this step the input JS string is converted into a byte buffer by dropping

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

2011-01-07 Thread Joshua Bell
On Fri, Jan 7, 2011 at 9:27 AM, Aryeh Gregor simetrical+...@gmail.comsimetrical%2b...@gmail.com wrote: On Fri, Jan 7, 2011 at 12:01 AM, Boris Zbarsky bzbar...@mit.edu wrote: Note that it's not that uncommon to use atob on things that came from other base64-producing tools, not just from

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

2011-01-06 Thread Aryeh Gregor
I've written a provisional spec for window.atob() and window.btoa(): http://aryeh.name/spec/base64.html These are functions supported by all browsers except IE, which do base64 encoding and decoding. I also wrote a fairly complete test suite, at:

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

2011-01-06 Thread Boris Zbarsky
On 1/6/11 3:25 PM, Aryeh Gregor wrote: Browsers disagreed about how to handle input to atob() that can't be produced by btoa(). Firefox mostly throws exceptions, WebKit is slightly more lenient, and Opera doesn't throw exceptions at all. gsnedders told me Opera's behavior caused site compat