Peña, Botp wrote:

> fr daniel:
> # Power tools for the File class.  Additional methods include
> # which, whereis,
> # head, tail, middle, wc, null, nl_convert, touch and binary?.
> 
> very cool and helpful. now win users aren't left so far behind..
> 
> maybe, i can create a more efficient grep -r now, one that does not
> include binary files. Will #binary? work on unix too?

Yep. In a *nix file read/write context, specifying binary does nothing,
because Unix doesn't honor the distinction, so the test "binary?" should
always "work". It is only meaningful in Windows.

In fact, the entire "binary" idea was created to deal with the weird Windows
line endings. If "binary" is specified, the file read/write system stops
translating "\n\r" to "\n" on read, and "\n" to "\n\r" on write. That's
all.

A variation on "binary?" might read a file to see if it deviates from 7-bit
ASCII, but this will fail for perfectly valid Unicode text files. So IMHO
it's a bad idea.

-- 
Paul Lutus
http://www.arachnoid.com