title: Detecting if a file is binary or plain text?
body: <p>How can I detect if a file is binary or a plain text?</p>
  
  <p>Basically my .NET app is processing batch files and extracting data however I don't want to process binary files. </p>
  
  <p>As a solution I'm thinking about analysing first X bytes of the file and if there are more unprintable characters than printable characters it should be binary.</p>
  
  <p>Is this the right way to do it? Is there any better implementation for this task?</p>