From 8712dad9a2f4e1963f2e23a4f83c16d00a3d47de Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 8 Jun 2007 01:07:48 +0200 Subject: [PATCH] [svn] fixed unicode issues with dump textile library. this fixes #249. --HG-- branch : trunk --- jinja/filters.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/jinja/filters.py b/jinja/filters.py index 4cd360f..619148b 100644 --- a/jinja/filters.py +++ b/jinja/filters.py @@ -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) -- 2.26.2