[Python-checkins] r71445 - python/branches/py3k/Lib/pydoc.py

georg.brandl python-checkins at python.org
Fri Apr 10 10:31:48 CEST 2009


Author: georg.brandl
Date: Fri Apr 10 10:31:48 2009
New Revision: 71445

Log:
#5698, part 2: generate a meta info in pydoc HTML pages indicating the encoding, and fix the -w option to use the correct encoding.

Modified:
   python/branches/py3k/Lib/pydoc.py

Modified: python/branches/py3k/Lib/pydoc.py
==============================================================================
--- python/branches/py3k/Lib/pydoc.py	(original)
+++ python/branches/py3k/Lib/pydoc.py	Fri Apr 10 10:31:48 2009
@@ -414,9 +414,10 @@
 
     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 @@
     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')


More information about the Python-checkins mailing list