At 12:13 08/09/09, Tanaka Akira 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.

Wouldn't "r:BINARY" or some such be able to do the job?
I know you don't like BINARY as an encoding, but it might
help here. I don't know why Matz doesn't like binread,
but I can understand it because there may be many other
reading methods where a bin... variant may be helpful.

Regards,    Martin.



#-#-#  Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
#-#-#  http://www.sw.it.aoyama.ac.jp       mailto:duerst / it.aoyama.ac.jp