From: Oleg Broytman Date: Fri, 3 Jan 2014 12:53:31 +0000 (+0400) Subject: Encode unicode parts X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=90c4a200cf90ab8ea15b5a8e1a746fd5196141a6;p=phdru.name%2Fphdru.name.git Encode unicode parts --- diff --git a/phd.py b/phd.py index 1939483..d1821b1 100644 --- a/phd.py +++ b/phd.py @@ -80,7 +80,13 @@ class phd(Template): subtitle = "

%s

" % subtitle body = parts["body"] - parts = [part for part in (title, subtitle, body) if part] + parts = [] + for part in (title, subtitle, body): + if not part: + continue + if isinstance(part, unicode): + part = part.encode('utf-8') + parts.append(part) return "\n\n".join(parts) def mkd2html(self):