binary vs. text?

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Dec 11 17:23:32 EST 2006


Hi Chris,

Sarah's answer sounds good (I mean fully reliable) but may appear  
unusable with heavy files you download from the internet.
As for us we use another method based on statistics by checking  
charToNum's chars.
On Windows, it appears that checking 60 chars and finding more than 3  
chars the charToNum of which is less than 9 or greater than 175 gives  
an "almost" fully reliable result ;-)

Le 11 déc. 06 à 23:09, Chris Sheffield a écrit :

> Does anyone have a sure fire way to determine if a file is binary  
> or text?
>
> 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?


Best Regards from Paris,
Eric Chatonet
------------------------------------------------------------------------ 
----------------------
http://www.sosmartsoftware.com/    eric.chatonet at sosmartsoftware.com/





More information about the use-livecode mailing list