From 90c4a200cf90ab8ea15b5a8e1a746fd5196141a6 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 3 Jan 2014 16:53:31 +0400 Subject: [PATCH] Encode unicode parts --- phd.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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): -- 2.39.5