diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-01-20 08:34:27 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-01-20 08:34:27 (GMT) |
commit | aebb6d3682e08c93d8468a9291180c5cbdc2df1b (patch) | |
tree | ba0911b049da0af81e28d8335224653285bd77e8 /Lib/xmlrpc | |
parent | 744fdfbf9a749c3adfe01d927af15a5b54e75878 (diff) | |
download | cpython-aebb6d3682e08c93d8468a9291180c5cbdc2df1b.zip cpython-aebb6d3682e08c93d8468a9291180c5cbdc2df1b.tar.gz cpython-aebb6d3682e08c93d8468a9291180c5cbdc2df1b.tar.bz2 |
Issue #26147: xmlrpc now works with strings not encodable with used
non-UTF-8 encoding.
Diffstat (limited to 'Lib/xmlrpc')
-rw-r--r-- | Lib/xmlrpc/client.py | 4 | ||||
-rw-r--r-- | Lib/xmlrpc/server.py | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/Lib/xmlrpc/client.py b/Lib/xmlrpc/client.py index 25e684f..bf42835 100644 --- a/Lib/xmlrpc/client.py +++ b/Lib/xmlrpc/client.py @@ -955,8 +955,6 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None, # standard XML-RPC wrappings if methodname: # a method call - if not isinstance(methodname, str): - methodname = methodname.encode(encoding) data = ( xmlheader, "<methodCall>\n" @@ -1422,7 +1420,7 @@ class ServerProxy: # call a method on the remote server request = dumps(params, methodname, encoding=self.__encoding, - allow_none=self.__allow_none).encode(self.__encoding) + allow_none=self.__allow_none).encode(self.__encoding, 'xmlcharrefreplace') response = self.__transport.request( self.__host, diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py index 304e218..5b5bf7c 100644 --- a/Lib/xmlrpc/server.py +++ b/Lib/xmlrpc/server.py @@ -269,7 +269,7 @@ class SimpleXMLRPCDispatcher: encoding=self.encoding, allow_none=self.allow_none, ) - return response.encode(self.encoding) + return response.encode(self.encoding, 'xmlcharrefreplace') def system_listMethods(self): """system.listMethods() => ['add', 'subtract', 'multiple'] @@ -622,7 +622,7 @@ class MultiPathXMLRPCServer(SimpleXMLRPCServer): response = dumps( Fault(1, "%s:%s" % (exc_type, exc_value)), encoding=self.encoding, allow_none=self.allow_none) - response = response.encode(self.encoding) + response = response.encode(self.encoding, 'xmlcharrefreplace') return response class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): |