On Mon, Sep 8, 2008 at 11:13 PM, Tanaka Akira <akr / fsij.org> wrote:
> In article <9888DBB2-0FE8-4C5C-8EF0-02D7C30157FA / pragprog.com>,
>  Dave Thomas <dave / pragprog.com> 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.

Would the encoding of File.binread() be BINARY?

If so, this feature sounds good, though as others have mentioned
having File.open("foo","rb") set the encoding to BINARY would be best
for 1.8 compatibility.
If this change is not possible and File.binread() will do this
instead, I think that'd be a good compromise.

-greg


-- 
Technical Blaag at: http://blog.majesticseacreature.com | Non-tech
stuff at: http://metametta.blogspot.com