binary vs. text?

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Dec 11 17:22:04 EST 2006


On 12/12/06 12:15 AM, "Ruslan Zasukhin" <sunshine at public.kherson.ua> wrote:

> On 12/12/06 12:09 AM, "Chris Sheffield" <cmsheffield at gmail.com> wrote:
> 
> Hi Chris,
> 
>> 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?
> 
> If file follow unicode rules, it have special signature on start
> 
> I did not hear about such ability define kind of file..

Well, I think you can try next:

1) check unicode signature.
    
    if you have find it -- this is unicode textfile

2) ELSE 

    you can scan the whole file or its part,
    byte for byte to see if you meat a ZERO byte.

        if YES - its a binary file.


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]





More information about the use-livecode mailing list