WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Workaround bug in xmlrpclib's string escaping. That libr

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Workaround bug in xmlrpclib's string escaping. That library outputs invalid
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 04 Apr 2006 15:24:13 +0000
Delivery-date: Tue, 04 Apr 2006 08:55:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 395e57314710c0c8d21e3ebc695f17ef6b93709d
# Parent  13e6993a0c6536a4d51453409011a54c22fbf216
Workaround bug in xmlrpclib's string escaping.  That library outputs invalid
UTF-8 if given a string containing high-bit characters, so instead pass in
Unicode strings, for which the escaping is correct.

This fixes a bug seen when the dmesg of a machine contains high bit characters,
but I'm sure there are other ways in which it might be triggered.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 13e6993a0c65 -r 395e57314710 tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py       Tue Apr  4 08:53:53 2006
+++ b/tools/python/xen/util/xmlrpclib2.py       Tue Apr  4 10:08:20 2006
@@ -19,6 +19,8 @@
 """
 An enhanced XML-RPC client/server interface for Python.
 """
+
+import types
 
 from httplib import HTTPConnection, HTTP
 from xmlrpclib import Transport
@@ -77,6 +79,15 @@
             else:
                 response = self._dispatch(method, params)
 
+            # Convert strings to unicode strings so that they are escaped
+            # properly by xmlrpclib.  We use latin-1 here, but any
+            # ASCII-compatible scheme would do -- we just care about getting
+            # the bytes across the wire.
+            # Any message handler that actually cares about the charset in
+            # use should be returning Unicode strings.
+            if isinstance(response, types.StringType):
+                response = unicode(response, 'iso-8859-1')
+
             response = (response,)
             response = xmlrpclib.dumps(response,
                                        methodresponse=1,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Workaround bug in xmlrpclib's string escaping. That library outputs invalid, Xen patchbot -unstable <=