Heuristic auto-detection of text encodings and binary files