From: daz Date: 2005-08-07T17:16:08+09:00 Subject: Re: Unpack binary files. dave.m wrote: > > Hy list, > > > I would like to append to a ruby script a tarball and a license file. > > Both are in the form: > > # data........................................ > > How would you convert the tarball binary data? tar = "i6\253m\251e" # in: binary content b64 = [tar].pack('m') # out: Base64 encoded string p b64 #-> "aTarball\n" > > If I split the license text lines and then gsub(/\n/, '\n') them > i have a bad output: If you split on /\n/, the newline will disappear so it's not now available to gsub. What about this ? # make some input data licin = <