use codecs to save the html file

This commit is contained in:
Simon
2012-11-01 00:48:32 +01:00
parent 5e4a4067e1
commit 5c3f0a873f

View File

@@ -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)