From: 7stud -- Date: 2009-08-23T00:16:02+09:00 Subject: Re: # Oleg Igor wrote: > require "zlib" > > def inflate(string) > zstream = Zlib::Inflate.new > buf = zstream.inflate(string) > zstream.finish > zstream.close > buf > end > > Work fine with ruby 1.8, and do not work in ruby 1.9 > # > what is wrong ? > > Oleg. require "zlib" def deflate(string) zipper = Zlib::Deflate.new data = zipper.deflate("hello world", Zlib::FINISH) end def inflate(string) zstream = Zlib::Inflate.new buf = zstream.inflate(string) zstream.finish zstream.close buf end compressed = deflate("hello world") p compressed uncompressed = inflate(compressed) puts uncompressed $ ruby19 -v ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin8.11.1] $ ruby19 r1test.rb "x\x9C\xCBH\xCD\xC9\xC9W(\xCF/\xCAI\x01\x00\x1A\v\x04]" hello world -- Posted via http://www.ruby-forum.com/.