module_formatter.return_data: use UTF-8 encoding

The text parameter can contain non-ASCII characters, so we'll encode it
using UTF-8. For example the DOCUMENTATION of the bzr module has such
characters in the name of the author.
pull/2432/head
Cristian Ciupitu 12 years ago
parent 9bd586acdb
commit 29aaa5e693

@ -127,7 +127,7 @@ def load_examples_section(text):
def return_data(text, options, outputname, module): def return_data(text, options, outputname, module):
if options.output_dir is not None: if options.output_dir is not None:
f = open(os.path.join(options.output_dir, outputname % module), 'w') f = open(os.path.join(options.output_dir, outputname % module), 'w')
f.write(text) f.write(text.encode('utf-8'))
f.close() f.close()
else: else:
print text print text

Loading…
Cancel
Save