fix special characters
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 18 Aug 2010 09:09:33 +0000 (11:09 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 18 Aug 2010 09:09:33 +0000 (11:09 +0200)
librarian/epub.py

index a0d9742..92df2d4 100644 (file)
@@ -103,12 +103,11 @@ def replace_characters(node):
     def replace_chars(text):
         if text is None:
             return None
     def replace_chars(text):
         if text is None:
             return None
-        return text.replace("&", "&amp;")\
-                   .replace("---", "&#8212;")\
-                   .replace("--", "&#8211;")\
-                   .replace(",,", "&#8222;")\
-                   .replace('"', "&#8221;")\
-                   .replace("'", "&#8217;")
+        return text.replace("---", u"\u2014")\
+                   .replace("--", u"\u2013")\
+                   .replace(",,", u"\u201E")\
+                   .replace('"', u"\u201D")\
+                   .replace("'", u"\u2019")
     if node.tag == 'extra':
         node.clear()
     else:
     if node.tag == 'extra':
         node.clear()
     else: