]> git.phdru.name Git - phdru.name/phdru.name.git/commitdiff
Encode unicode parts
authorOleg Broytman <phd@phdru.name>
Fri, 3 Jan 2014 12:53:31 +0000 (16:53 +0400)
committerOleg Broytman <phd@phdru.name>
Fri, 3 Jan 2014 12:53:31 +0000 (16:53 +0400)
phd.py

diff --git a/phd.py b/phd.py
index 19394839d9ebef92aca3173f3cdc708c34875f71..d1821b1abcc93beed7d6b5bcdedccbacc2c623a3 100644 (file)
--- a/phd.py
+++ b/phd.py
@@ -80,7 +80,13 @@ class phd(Template):
          subtitle = "<h2>%s</h2>" % 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):