Commit 50fdcdf0 authored by Georg Brandl's avatar Georg Brandl

Fix encoding handling of the pydoc-topics writer.

parent c0eaecaf
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Sphinx extension with Python doc-specific markup. 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. :license: Python license.
""" """
...@@ -201,11 +201,12 @@ class PydocTopicsBuilder(Builder): ...@@ -201,11 +201,12 @@ class PydocTopicsBuilder(Builder):
document.append(doctree.ids[labelid]) document.append(doctree.ids[labelid])
destination = StringOutput(encoding='utf-8') destination = StringOutput(encoding='utf-8')
writer.write(document, destination) writer.write(document, destination)
self.topics[label] = str(writer.output) self.topics[label] = writer.output.encode('utf-8')
def finish(self): def finish(self):
f = open(path.join(self.outdir, 'topics.py'), 'w') f = open(path.join(self.outdir, 'topics.py'), 'w')
try: try:
f.write('# -*- coding: utf-8 -*-\n')
f.write('# Autogenerated by Sphinx on %s\n' % asctime()) f.write('# Autogenerated by Sphinx on %s\n' % asctime())
f.write('topics = ' + pformat(self.topics) + '\n') f.write('topics = ' + pformat(self.topics) + '\n')
finally: finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment