Usually, text files don't contain symbols with code less then 0x20, except of \r \n and \t.
you can analyze each symbol in file, and, if there are several characters less then 0x20 ( except of \r \n and \t ) you can say, that this file is NOT a text