From: "Iñaki Baz Castillo" Date: 2009-12-03T09:27:30+09:00 Subject: Re: Encoding/decoding a image as Base64 (fails under Ruby1.9 but works under Ruby1.8) [SOLVED] El Jueves, 3 de Diciembre de 2009, Iñaki Baz Castillo escribió: > The difference is in the second step, the decoding process, since > "base64.txt" file is the same using Ruby1.8 or 1.9. Ok, the issue is fixed by uing "IO.read" rather than "IO.readlines": - Decode "base64.txt" as a PNG "new_icon.png" file: -------------------------------------- File.open('new_icon.png', 'wb') do |file| file << (IO.read('base64.txt').to_s.unpack('m')).first end -------------------------------------- -- Iñaki Baz Castillo