]> granicus.if.org Git - python/commitdiff
Fix encoding handling of the pydoc-topics writer.
authorGeorg Brandl <georg@python.org>
Sun, 4 Mar 2012 15:12:02 +0000 (16:12 +0100)
committerGeorg Brandl <georg@python.org>
Sun, 4 Mar 2012 15:12:02 +0000 (16:12 +0100)
Doc/tools/sphinxext/pyspecific.py

index d928cfd1e0b2a87c3fb8ae11189d576824a87527..f35953081ef09edbc85c1287814ce1e2749708ab 100644 (file)
@@ -5,7 +5,7 @@
 
     Sphinx extension with Python doc-specific markup.
 
-    :copyright: 2008, 2009, 2010 by Georg Brandl.
+    :copyright: 2008, 2009, 2010, 2011, 2012 by Georg Brandl.
     :license: Python license.
 """
 
@@ -201,11 +201,12 @@ class PydocTopicsBuilder(Builder):
             document.append(doctree.ids[labelid])
             destination = StringOutput(encoding='utf-8')
             writer.write(document, destination)
-            self.topics[label] = str(writer.output)
+            self.topics[label] = writer.output.encode('utf-8')
 
     def finish(self):
         f = open(path.join(self.outdir, 'topics.py'), 'w')
         try:
+            f.write('# -*- coding: utf-8 -*-\n')
             f.write('# Autogenerated by Sphinx on %s\n' % asctime())
             f.write('topics = ' + pformat(self.topics) + '\n')
         finally: