Fix UTF-8 issues in reading templates.