× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Joe Sam Shirah wrote:
>         As you might expect from the response so far, it is nearly
> impossible, in the general case, to determine text/binary format with 100%
> reliability.  Most attempts check for magic numbers ( like 0xCAFEBABE for
> Java classes ) and values greater than 127 to detect non-ASCII values.

Actually, I found an open source solution that I can hand a byte array
and it will tell me what kind of file it is.

It's jMimeMagic on sourceforge (don't have the url hand right now).

I just read the first two K of the file into a byte array, use
jMimeMagic to check the file ... if it can figure out the file, I try
again after using CharConvert to change the CCSID on the byte array.

Seems to work ok so far.

david


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.