How can I detect if a file is binary or a plain text?
Basically my .NET app is processing batch files and extracting data however I don't want to process binary files.
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.
Is this the right way to do it? Is there any better implementation for this task?