From: "Rebhan, Gilbert" Date: 2007-08-21T17:33:48+09:00 Subject: Re: Test if file is binary ? -----Original Message----- From: Xavier Noria [mailto:fxn@hashref.com] Sent: Tuesday, August 21, 2007 10:25 AM To: ruby-talk ML Subject: Re: Test if file is binary ? On Aug 21, 2007, at 10:21 AM, Rebhan, Gilbert wrote: > Is there an exisiting standard what is considered as a binary file, > means a > rule like check the first block from a file and = > > - if control characters (ASCII 0-32) and "high ASCII" (> 128) are > found >> 30 % > it's considered as binary file otherwise textfile > > - if control characters (ASCII 0-32 and > 128) are found == 0 it's > always > considered as textfile > > ?? /* What's the heuristic in Subversion? */ the subversion FAQ http://subversion.tigris.org/faq.html#binary-files has = " ... if any of the bytes are zero, or if more than 15% are not ASCII printing characters, then Subversion calls the file binary. This heuristic might be improved in the future, however." Regards, Gilbert