From 5c3f0a873f2c34ba40ea79e749edb88b04112074 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 1 Nov 2012 00:48:32 +0100 Subject: [PATCH] use codecs to save the html file --- sigal/writer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sigal/writer.py b/sigal/writer.py index d8b4b27..9cdc974 100644 --- a/sigal/writer.py +++ b/sigal/writer.py @@ -27,6 +27,7 @@ Generate html pages for each directory of images from __future__ import absolute_import +import codecs import copy import os @@ -133,9 +134,8 @@ class Writer(): 'thumb': os.path.join(d, thumb_name) }) - page = self.template.render(paths[relpath], **ctx).encode('utf-8') + # generate html page and save + page = self.template.render(paths[relpath], **ctx) - # save page - f = open(os.path.join(path, INDEX_PAGE), 'w') - f.write(page) - f.close() + with codecs.open(os.path.join(path, INDEX_PAGE), 'w', 'utf-8') as f: + f.write(page)