Deal with different file encodings.