Get the character encoding of a text file. Useful for language detection.