[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/renderer/rest.py Fixed the ReST renderer to ouput unicode and not UTF-8 encoded strings.

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Oct 16 09:02:53 EDT 2004


Log message for revision 28203:
  Fixed the ReST renderer to ouput unicode and not UTF-8 encoded strings. 
  Thanks to Bjorn Tillenius for providing the patch.
  

Changed:
  U   Zope3/trunk/src/zope/app/renderer/rest.py

-=-
Modified: Zope3/trunk/src/zope/app/renderer/rest.py
===================================================================
--- Zope3/trunk/src/zope/app/renderer/rest.py	2004-10-16 12:38:12 UTC (rev 28202)
+++ Zope3/trunk/src/zope/app/renderer/rest.py	2004-10-16 13:02:52 UTC (rev 28203)
@@ -143,12 +143,21 @@
     __used_for__ = IReStructuredTextSource
 
     def render(self):
-        "See zope.app.interfaces.renderer.IHTMLRenderer"
+        r"""See zope.app.interfaces.renderer.IHTMLRenderer
+
+        Let's make sure that inputted unicode stays as unicode:
+
+        >>> renderer = ReStructuredTextToHTMLRenderer(u'b\xc3h', None)
+        >>> renderer.render()
+        u'<div class="document">\nb\xc3h</div>\n'
+        """
         settings_overrides = {
             'footnote_references': 'brackets',
             'report_level': 1,
             'halt_level': 6,
             'stylesheet': 'zope3.css',
+            'input_encoding': 'unicode',
+            'output_encoding': 'unicode',
             }
         html = docutils.core.publish_string(
             self.context,



More information about the Zope3-Checkins mailing list