From: Tanaka Akira Date: 2008-09-09T12:13:00+09:00 Subject: [ruby-core:18511] Re: Ruby 1.9 strings & character encoding In article <9888DBB2-0FE8-4C5C-8EF0-02D7C30157FA@pragprog.com>, Dave Thomas writes: > But we also quite often want to work the the whole file. I believe > Matz uses the example of something like > > data = File.open("dave.gif", "b:ASCII-8BIT").read > fail unless data =~ /^GIF/ "rb:ASCII-8BIT"? It works. Just "rb" also works for /^GIF/. > Binary doesn't always mean bytes--it just means that you don't have a > consistent encoding throughout the file. So I'd strongly support the > idea of "b" defaulting to a binary encoding. I think what we need is File.binread(filename). matz doesn't accept it yet, though. -- Tanaka Akira