Better handling of file encodings