diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-23 01:15:32 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-23 01:15:32 +0200 |
commit | 51b719814e0c32fd0eea570d3769d323bea97cab (patch) | |
tree | c6b7ca9161cca8f06b42217244cb59a5b51370db | |
parent | 2156594d8c9ce7ca8b3552d4a3e1043bc602d717 (diff) | |
download | cpython-git-51b719814e0c32fd0eea570d3769d323bea97cab.tar.gz |
Issue #12931: xmlrpclib now encodes Unicode URI to ISO-8859-1, instead of
failing with a UnicodeDecodeError.
-rw-r--r-- | Lib/test/test_xmlrpc.py | 3 | ||||
-rw-r--r-- | Lib/xmlrpclib.py | 3 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 6310c97bd7..79100e9a53 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -472,6 +472,9 @@ class SimpleServerTestCase(BaseServerTestCase): # protocol error; provide additional information in test output self.fail("%s\n%s" % (e, getattr(e, "headers", ""))) + def test_unicode_host(self): + server = xmlrpclib.ServerProxy(u"http://%s:%d/RPC2"%(ADDR, PORT)) + self.assertEqual(server.add("a", u"\xe9"), u"a\xe9") # [ch] The test 404 is causing lots of false alarms. def XXXtest_404(self): diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py index 3cba39f59d..653c424521 100644 --- a/Lib/xmlrpclib.py +++ b/Lib/xmlrpclib.py @@ -1539,6 +1539,9 @@ class ServerProxy: allow_none=0, use_datetime=0): # establish a "logical" server connection + if isinstance(uri, unicode): + uri = uri.encode('ISO-8859-1') + # get the url import urllib type, uri = urllib.splittype(uri) @@ -47,6 +47,9 @@ Core and Builtins Library ------- +- Issue #12931: xmlrpclib now encodes Unicode URI to ISO-8859-1, instead of + failing with a UnicodeDecodeError. + - Issue #8933: distutils' PKG-INFO files will now correctly report Metadata-Version: 1.1 instead of 1.0 if a Classifier or Download-URL field is present. |