Re: How to fix CRLF stuff...


Subject: Re: How to fix CRLF stuff...
From: Jeremy Buchmann (jeremy@wellsgaming.com)
Date: Tue Feb 13 2001 - 12:22:21 EST


Okay, this seems to be getting very complicated...is there a more simple
approach?

For example, I use the Unix command "less" quite a bit to read through text
files. But when I type "less picture.jpg", less tells me that it's a binary
file. How does it know? I don't know exactly how it works, but I'm
guessing it just scans the first few hundred or thousand bytes and checks
for non-text/non-line-ending characters and if any are there, it reports it
as a binary file. This may sound overly-simplistic, but it seems to work
incredibly well. What do you think? Here are the pros and cons I could
think of:

Good Things:
1) Much more simple to implement
2) Should be pretty effective

Number 1) is the main thing. Much less work, less complication, fewer bugs.
As for 2), well it should be as effective as less if we used it's method of
examining files (and I've never seen less be wrong).

Bad Things:
1) It's not a perfect way of determining text/binary files.
2) It may be slower.

Regarding 1), sure it's not perfect, but I think it'd be pretty darn good.
I can think of a few things (like tar files with mostly text files and then
a binary file at the end) that might thwart it, but those are special cases.
Besides, can the dual-process-IPC method garantee 100% accuracy? As for 2),
I don't think it'd be *that* slow (less can do it pretty quickly) and
besides, when have Mac users been concerned with speed? No one buys a Mac
because it's a speed demon.

Thoughts?

--Jeremy [jeremy@wellsgaming.com]



This archive was generated by hypermail 2b28 : Sun Oct 14 2001 - 03:04:32 EDT