Fixes file handling to be fully utf-8.