]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Allow non-ascii (but still latin1) in our fake byte literals
authorBen Darnell <ben@bendarnell.com>
Sun, 26 Jun 2011 01:54:37 +0000 (18:54 -0700)
committerBen Darnell <ben@bendarnell.com>
Sun, 26 Jun 2011 01:54:37 +0000 (18:54 -0700)
tornado/test/httpserver_test.py
tornado/util.py

index 69ea01cdf6954fb7803afcc2b065b9b7d6c3515a..fa48f5c21292c3e23f1323305901a03d6b235962 100644 (file)
@@ -110,7 +110,7 @@ class HTTPConnectionTest(AsyncHTTPTestCase, LogTrapTestCase):
         response = self.raw_fetch([
                 b("POST /multipart HTTP/1.0"),
                 b("Content-Type: multipart/form-data; boundary=1234567890"),
-                u"X-Header-encoding-test: \u00e9".encode("latin1"),
+                b("X-Header-encoding-test: \xe9"),
                 ],
                                   b("\r\n").join([
                     b("Content-Disposition: form-data; name=argument"),
index 964a9f02b0cd39d7d5afba71e3d92c0725236da0..4ac59908f5781d45889764441fcb524c67c37d15 100644 (file)
@@ -19,11 +19,11 @@ def import_object(name):
 # a byte literal (str in 2.x, bytes in 3.x).  There's no way to do this
 # in a way that supports 2.5, though, so we need a function wrapper
 # to convert our string literals.  b() should only be applied to literal
-# ascii strings.  Once we drop support for 2.5, we can remove this function
+# latin1 strings.  Once we drop support for 2.5, we can remove this function
 # and just use byte literals.
 if str is unicode:
     def b(s):
-        return s.encode('ascii')
+        return s.encode('latin1')
     bytes_type = bytes
 else:
     def b(s):