Commit 388faac8 authored by Georg Brandl's avatar Georg Brandl

#5698, part 2: generate a meta info in pydoc HTML pages indicating the...

#5698, part 2: generate a meta info in pydoc HTML pages indicating the encoding, and fix the -w option to use the correct encoding.
parent e606694f
...@@ -414,9 +414,10 @@ class HTMLDoc(Doc): ...@@ -414,9 +414,10 @@ class HTMLDoc(Doc):
def page(self, title, contents): def page(self, title, contents):
"""Format an HTML page.""" """Format an HTML page."""
return ''' return '''\
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title> <html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8"> </head><body bgcolor="#f0f0f8">
%s %s
</body></html>''' % (title, contents) </body></html>''' % (title, contents)
...@@ -1510,7 +1511,7 @@ def writedoc(thing, forceload=0): ...@@ -1510,7 +1511,7 @@ def writedoc(thing, forceload=0):
try: try:
object, name = resolve(thing, forceload) object, name = resolve(thing, forceload)
page = html.page(describe(object), html.document(object, name)) 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.write(page)
file.close() file.close()
print('wrote', name + '.html') print('wrote', name + '.html')
......
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