Fix exception when processing files with non-unicode characters.