From d1e5ad2696ee4aa0a7ad0e3527f83ba73aa67865 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Thu, 7 Mar 2013 18:21:05 +0100 Subject: [PATCH] Set proper HTML5 doctype and encoding for HTML output. --- dosagelib/events.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dosagelib/events.py b/dosagelib/events.py index a464840d0..1e9268c08 100644 --- a/dosagelib/events.py +++ b/dosagelib/events.py @@ -3,6 +3,7 @@ import os import time import urllib +import codecs from . import rss, util, configuration class EventHandler(object): @@ -120,9 +121,11 @@ class HtmlEventHandler(EventHandler): yesterdayUrl = self.getUrlFromFilename(self.fnFromDate(yesterday)) tomorrowUrl = self.getUrlFromFilename(self.fnFromDate(tomorrow)) - self.html = file(fn, 'w') - self.html.write(''' + self.html = codecs.open(fn, 'w', 'utf-8') + self.html.write(u''' + + Comics for %s @@ -137,22 +140,22 @@ class HtmlEventHandler(EventHandler): if self.lastComic != comic: self.newComic(comic) url = self.getUrlFromFilename(filename) - self.html.write('
  • %s
  • \n' % (url, os.path.basename(filename))) + self.html.write(u'
  • %s
  • \n' % (url, os.path.basename(filename))) def newComic(self, comic): """Start new comic list in HTML.""" if self.lastComic is not None: - self.html.write(' \n') + self.html.write(u' \n') self.lastComic = comic - self.html.write('''
  • %s
  • + self.html.write(u'''
  • %s
  • \n') - self.html.write(''' + self.html.write(u' \n') + self.html.write(u''' ''') self.html.close()