open file as utf-8

The file was opened with open, which uses ascii. This triggers UnicodeDecodeError, if a template contains non ascii chars.

This fixes it by forcing to open the file as utf-8.