Try to detect whether the file is a text file by name or extension.
This will avoid invalid type detections in `file` command, due to
Linux's magic chars.