From 7cd057d3c5e51c593e9cd3992afe697d1c4c9ede Mon Sep 17 00:00:00 2001 From: Thor77 Date: Wed, 2 Nov 2016 21:24:19 +0100 Subject: [PATCH] Write template-output as utf-8 --- tsstats/template.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsstats/template.py b/tsstats/template.py index 2c42ccb..2b456b4 100644 --- a/tsstats/template.py +++ b/tsstats/template.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import logging +from codecs import open from datetime import datetime from os.path import dirname @@ -63,7 +64,7 @@ def render_template(clients, output, title='TeamspeakStats', template_env.filters['frmttime'] = frmttime template = template_env.get_template(template_path) logger.debug('Rendering template %s', template) - with open(output, 'w') as f: + with open(output, 'w', encoding='utf-8') as f: f.write(template.render(title=title, objs=objs, debug=logger.level <= logging.DEBUG, creation_time=datetime.now()))