[svn] fixed unicode issues with dump textile library. this fixes #249.
authorArmin Ronacher <armin.ronacher@active-4.com>
Thu, 7 Jun 2007 23:07:48 +0000 (01:07 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Thu, 7 Jun 2007 23:07:48 +0000 (01:07 +0200)
--HG--
branch : trunk

jinja/filters.py

index 4cd360ff33faee12315c9e77f0c35081a6a39c29..619148b8aa7d92de02119397741dd66e8ebd3fef 100644 (file)
@@ -538,7 +538,7 @@ def do_textile(s):
     .. _PyTextile: http://dealmeida.net/projects/textile/
     """
     from textile import textile
-    return textile(s)
+    return textile(s.encode('utf-8')).decode('utf-8')
 do_textile = stringfilter(do_textile)
 
 
@@ -551,7 +551,7 @@ def do_markdown(s):
     .. _Python-markdown: http://www.freewisdom.org/projects/python-markdown/
     """
     from markdown import markdown
-    return markdown(s)
+    return markdown(s.encode('utf-8')).decode('utf-8')
 do_markdown = stringfilter(do_markdown)
 
 
@@ -564,12 +564,9 @@ def do_rst(s):
 
     .. _docutils: from http://docutils.sourceforge.net/
     """
-    try:
-        from docutils.core import publish_parts
-        parts = publish_parts(source=s, writer_name='html4css1')
-        return parts['fragment']
-    except:
-        return s
+    from docutils.core import publish_parts
+    parts = publish_parts(source=s, writer_name='html4css1')
+    return parts['fragment']
 do_rst = stringfilter(do_rst)