On Mon, Nov 19, 2007 at 06:49:54AM +0900, Trans wrote: > > One other aside to this. I notice Ruby's current lib produces: > > Base64.encode64('a') > => "YQ==\n" > > But Minero's produces: > > Base64.encode('a') > => "YQ==" > > Is there supposed to be a trailing "\n" or not? Kindof. Base64 is defined in the MIME specs, so you are "supposed" to use it inside a MIME message, in which case all lines should be wrapped (at 78 chars, IIRC) Its widely used outside MIME, though, and in those cases its not clear. Anybody using ruby's base64 ([].pack('m')) needs to be aware of this, possibly stripping newlines if they don't want them (maybe to go in a URL, for example). Good b64 apis give the caller a choice of wrapping or not. Sam