In Ruby 1.9 the File and IO libraries were changed — they now seem to always interpret the data as encoded strings (e.g. UTF-8), and the returned values seem to be always strings.
I need to read a file in Ruby 1.9 byte by byte, without any modification or interpretation of the data.
I want to read byte sequences, not encoded strings.
Any tips on how to best do this?
I had a similar problem in a gem I wrote. Here’s the relevant code:
(you don’t need the require statements)