Added an option to specify the file encoding to use when reading the input file.