diff MoinMoin/parser/text_xslt.py @ 3824:aef3adf3f701

MoinMoinBugs/DoNotConvertUnicodeToUTF8ForXsltParser Initial patch applied and slightly improved.
author Thomas Pfaff <yael [at] gmx dot net>
date Fri, 11 Jul 2008 10:28:38 +0200
parents a1322262398a
children ff39884957af
line wrap: on
line diff
--- a/MoinMoin/parser/text_xslt.py	Thu Jul 10 16:13:24 2008 +0200
+++ b/MoinMoin/parser/text_xslt.py	Fri Jul 11 10:28:38 2008 +0200
@@ -28,7 +28,7 @@
     Dependencies = Dependencies
 
     def __init__(self, raw, request, **kw):
-        self.raw = raw.encode(config.charset)
+        self.raw = raw
         self.request = request
         self.form = request.form
         self._ = request.getText
@@ -87,14 +87,15 @@
                 input_factory = InputSource.InputSourceFactory(resolver=wiki_resolver)
 
                 page_uri = self.base_uri + wikiutil.url_quote(formatter.page.page_name)
-                raw = self.raw.strip()
-
+                # 4Suite needs an utf-8 encoded byte string instead of an unicode object
+                raw = self.raw.strip().encode('utf-8')
                 self.processor = Processor()
                 self.append_stylesheet() # hook, for extending this parser
                 self.processor.run(
                     input_factory.fromString(raw, uri=page_uri),
                     outputStream=out_file)
-                result = out_file.getvalue()
+                # Convert utf-8 encoded byte string into unicode
+                result = out_file.getvalue().decode('utf-8')
                 result = self.parse_result(result) # hook, for extending this parser
 
             except FtException, msg: