From: Tim Pease Date: 2006-11-11T00:27:22+09:00 Subject: Re: Trying to get pack to work with the * template character On 11/9/06, John Hahn wrote: > Ok, here's a snippet of my code. > > @image_array = Array.new > @image = File.open("test.JPG", "rb") do |image| > image.each_byte{|ch| @image_array << ch.to_s} > end > @temp = @image_array.pack("m*") > Correct me if I guess incorrectly here, but it looks like you want to base64 encode a JPG image file. Ruby has a nice Base64 class which will do this for you ... require 'base64' @temp = File.open("test.JPG", "rb") {|image| Base64.encode64( image.read )} Blessings, TwP