[openbeos] Re: Identifying Text Files

  • From: Ville Koskinen <vrkosk@xxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Fri, 09 Jun 2006 12:26:23 +0300 (EEST)

Would it be possible to use the BSD/MIT-licensed file utility?

ftp://ftp.astron.com/pub/file/file-4.17.tar.gz

It's a tool to guess what the file type is by taking a look at the
beginning of the file, especially the first few bytes (called the (file)
magic number). I think almost all variants of Unix have it, and it even
includes a magic number to MIME type converter. If nothing else, the file
src/ascmagic.c contains nice code to detect if the file is text or not and
even guesses its encoding.

-- 
Ville Koskinen



Other related posts: