Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50fdcdf

Browse files
committed
Fix encoding handling of the pydoc-topics writer.
1 parent c0eaeca commit 50fdcdf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Doc/tools/sphinxext/pyspecific.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Sphinx extension with Python doc-specific markup.
77
8-
:copyright: 2008, 2009, 2010 by Georg Brandl.
8+
:copyright: 2008, 2009, 2010, 2011, 2012 by Georg Brandl.
99
:license: Python license.
1010
"""
1111

@@ -201,11 +201,12 @@ def write(self, *ignored):
201201
document.append(doctree.ids[labelid])
202202
destination = StringOutput(encoding='utf-8')
203203
writer.write(document, destination)
204-
self.topics[label] = str(writer.output)
204+
self.topics[label] = writer.output.encode('utf-8')
205205

206206
def finish(self):
207207
f = open(path.join(self.outdir, 'topics.py'), 'w')
208208
try:
209+
f.write('# -*- coding: utf-8 -*-\n')
209210
f.write('# Autogenerated by Sphinx on %s\n' % asctime())
210211
f.write('topics = ' + pformat(self.topics) + '\n')
211212
finally:

0 commit comments

Comments
 (0)