From: James Masters Date: 2009-09-19T12:25:05+09:00 Subject: Re: Determining if a file is binary or text On Sep 18, 7:54 pm, Seebs wrote: > Well, you probably also want tabs and newlines.  :) Ah, good point... :) > I thought that until I found a dozen Makefiles with copyright symbols > embedded in them.  :P > > I'd say as a first approximation, just check for NUL bytes.  I'm pretty > sure that the vast majority of binary files will contain at least one, > and the vast majority of text files will contain none. Yeah, this is another idea that I had also considered... I'm just not sure if all of the binary files that I'm dealing with have NULL bytes though. But that might just be good enough. Fortunately, I'm working with a small team of individuals who will be authoring the files so I do have some control on the type of text that I'm looking for. So I might try [:print], \n, \t, and maybe \r (just in case) and then fall back on the NULL idea as a Plan B. Thanks again, -James