diff options
author | Georg Brandl <georg@python.org> | 2009-04-10 08:31:48 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-10 08:31:48 (GMT) |
commit | 388faac8cb5be6ad1ad474bae237b71bd00a1900 (patch) | |
tree | 571fb9e17b494aeb0271619b17b82f4c69c180ba | |
parent | e606694f027d880c3ce6e8a8385450bba2f4e15d (diff) | |
download | cpython-388faac8cb5be6ad1ad474bae237b71bd00a1900.zip cpython-388faac8cb5be6ad1ad474bae237b71bd00a1900.tar.gz cpython-388faac8cb5be6ad1ad474bae237b71bd00a1900.tar.bz2 |
#5698, part 2: generate a meta info in pydoc HTML pages indicating the encoding, and fix the -w option to use the correct encoding.
-rwxr-xr-x | Lib/pydoc.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 49c9aad..41dd6dd 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 '''\ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><title>Python: %s</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head><body bgcolor="#f0f0f8"> %s </body></html>''' % (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') |