From: James Gray Date: 2008-12-21T12:16:28+09:00 Subject: [ruby-core:20742] Re: Working with binary strings in Ruby 1.9? On Dec 20, 2008, at 7:03 PM, Michael Selig wrote: > On Sun, 21 Dec 2008 06:43:32 +1100, James Gray > wrote: > >> On Dec 20, 2008, at 12:49 PM, Hadmut Danisch wrote: >> >>> The code I am working on is parsing files with binary content >>> (such as >>> pictures, machine code, etc.). With 1.8, I could easily use >>> >>> * File.open{|f| f.read} to read the contents, >> >> In 1.9 use: >> >> File.binread(�) > > Alternatively you can specify 'encoding: "BINARY"' eg: > > File.open(, encoding: "BINARY") {|f| f.read} > or shorter > File.read(, encoding: "BINARY") I don't think you want to do that. You need to set a mode like "rb" to also shut off line ending conversion on Windows. James Edward Gray II