That worked well in 1.8.7, but not in 1.9.2.
On 10 Nov, 14:59, Luis Lavena <[email protected]> wrote: > On Nov 10, 7:51 am, jeb <[email protected]> wrote: > > > Hi, > > > I use a web service for delivering snailmail. I prepare a zip-file > > containing pdf for the letter, receivers and so on, encode it in > > base64 and send it as base 64 in my request. It won't work in 1.9.2 > > (the zip gets corrupted) but works fine in 1.8.7. I guess it's > > something with how binary strings are handled. This is the code that > > works in 1.8.7: > > > file_data = File.open(temp_file.path,"rb") {|io| io.read} > > file_data_64 = Base64.encode64(file_data) > > > Does anyone know how to do this in 1.9.2? > > require "base64" > > content = File.binread("filename") > encoded = Base64.encode64(content) > > There you go. > > -- > Luis Lavena -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

