Explicitly setting the encoding when reading and writing a file.