]> granicus.if.org Git - python/commitdiff
#5698, part 2: generate a meta info in pydoc HTML pages indicating the encoding,...
authorGeorg Brandl <georg@python.org>
Fri, 10 Apr 2009 08:31:48 +0000 (08:31 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 10 Apr 2009 08:31:48 +0000 (08:31 +0000)
Lib/pydoc.py

index 49c9aad55bb7f5d161ebe46f7f6426df6386709f..41dd6dd10a248931796822c394482649ce4346a4 100755 (executable)
@@ -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')