]> granicus.if.org Git - python/commitdiff
test_httpservers: Python CGI scripts have to be encoded to utf-8
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 17 Oct 2010 20:17:41 +0000 (20:17 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 17 Oct 2010 20:17:41 +0000 (20:17 +0000)
And not the locale encoding. With this commit, the test finally pass on Windows
with a non-ascii path :-)

Lib/test/test_httpservers.py

index 1aeee29f6598b0c46ec37f4e257ebc6ee27ccc9d..fa1fc594b60019c1acccf996c32d7169efbb31d5 100644 (file)
@@ -321,12 +321,12 @@ class CGIHTTPServerTestCase(BaseTestCase):
                 "Python executable path is not encodable to utf-8")
 
         self.file1_path = os.path.join(self.cgi_dir, 'file1.py')
-        with open(self.file1_path, 'w') as file1:
+        with open(self.file1_path, 'w', encoding='utf-8') as file1:
             file1.write(cgi_file1 % self.pythonexe)
         os.chmod(self.file1_path, 0o777)
 
         self.file2_path = os.path.join(self.cgi_dir, 'file2.py')
-        with open(self.file2_path, 'w') as file2:
+        with open(self.file2_path, 'w', encoding='utf-8') as file2:
             file2.write(cgi_file2 % self.pythonexe)
         os.chmod(self.file2_path, 0o777)