binary vs. text?

Geir A. Myrestrand geir.myrestrand at falconstor.com
Mon Dec 11 17:23:55 EST 2006


Chris Sheffield wrote:
> Does anyone have a sure fire way to determine if a file is binary or text?

There is no such thing as a sure fire way to determine if it is text or 
not, unless the definition of text can be clearly defined.

> I have need to create an import utility that will import data from a 
> text file (csv, tab-delimited, etc) into a database, but I'd like to 
> check the file before doing anything else just to make sure it is in 
> fact text and not binary.
> 
> Any thoughts?

I would just assume it is text, and then handle "wrong" input 
gracefully. Trying to parse the contents first to verify it would just 
add overhead, and is unnecessary if you do the former.

Consider my input as general, and not Revolution specific --my exposure 
to Revolution is modest, at least at this point...

-- 

Geir A. Myrestrand



More information about the use-livecode mailing list