From: Georg Brandl Date: Fri, 10 Apr 2009 08:31:48 +0000 (+0000) Subject: #5698, part 2: generate a meta info in pydoc HTML pages indicating the encoding,... X-Git-Tag: v3.1b1~322 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=388faac8cb5be6ad1ad474bae237b71bd00a1900;p=python #5698, part 2: generate a meta info in pydoc HTML pages indicating the encoding, and fix the -w option to use the correct encoding. --- diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 49c9aad55b..41dd6dd10a 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -414,9 +414,10 @@ class HTMLDoc(Doc): def page(self, title, contents): """Format an HTML page.""" - return ''' + return '''\ Python: %s + %s ''' % (title, contents) @@ -1510,7 +1511,7 @@ def writedoc(thing, forceload=0): try: object, name = resolve(thing, forceload) page = html.page(describe(object), html.document(object, name)) - file = open(name + '.html', 'w') + file = open(name + '.html', 'w', encoding='utf-8') file.write(page) file.close() print('wrote', name + '.html')