[Python-checkins] r88831 - python/branches/release26-maint/Lib/SimpleHTTPServer.py

barry.warsaw python-checkins at python.org
Fri May 20 22:48:21 CEST 2011


Author: barry.warsaw
Date: Fri May 20 22:48:20 2011
New Revision: 88831

Log:
Cross-port the fix for issue 11442 from the hg26 branch to the svn26
branch.



Modified:
   python/branches/release26-maint/Lib/SimpleHTTPServer.py

Modified: python/branches/release26-maint/Lib/SimpleHTTPServer.py
==============================================================================
--- python/branches/release26-maint/Lib/SimpleHTTPServer.py	(original)
+++ python/branches/release26-maint/Lib/SimpleHTTPServer.py	Fri May 20 22:48:20 2011
@@ -15,6 +15,7 @@
 import BaseHTTPServer
 import urllib
 import cgi
+import sys
 import shutil
 import mimetypes
 try:
@@ -131,7 +132,8 @@
         length = f.tell()
         f.seek(0)
         self.send_response(200)
-        self.send_header("Content-type", "text/html")
+        encoding = sys.getfilesystemencoding()
+        self.send_header("Content-type", "text/html; charset=%s" % encoding)
         self.send_header("Content-Length", str(length))
         self.end_headers()
         return f


More information about the Python-checkins mailing list