Bugs item #1576443, was opened at 2006-10-13 08:40 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576443&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 >Status: Closed >Resolution: Out of Date Priority: 5 Submitted By: Yang Zhang (yangzhang) Assigned to: Nobody/Anonymous (nobody) Summary: cStringIO misbehaving with unicode Initial Comment: The bug is the following: StringIO.StringIO(u'abc').getvalue() != cStringIO.StringIO(u'abc').getvalue() It all started with the following code: # client.py import cPickle as cp import xmlrpclib as x p=x.ServerProxy('http://localhost:8082') msg=u'abc' print msg print len(msg) p.foo(x.Binary(msg)) # client output abc 3 # server.py from twisted.web import server, xmlrpc class WikiXmlRpc(xmlrpc.XMLRPC): def xmlrpc_foo(self, x): print x.data print len(x.data) return 0 if __name__ == "__main__": import sys from twisted.internet import reactor siteRoot = WikiXmlRpc() reactor.listenTCP(8082, server.Site(siteRoot)) reactor.run( ) # server output abc 12 I wanted both hosts to agree on the length, so I started digging to find out what was up. Some time later.... <alus> zeeeee: you found a bug in xmlrpclib <alus> zeeeee: it's using cStringIO in a place where it can't <alus> odd. cStringIO does not react to unicode in a sane way <alus> cStringIO.StringIO(u'abc').getvalue() <alus> #=> 'a\x00b\x00c\x00' ... <alus> zeeeee: the heart of the matter is that StringIO.StringIO(u'abc').getvalue() != cStringIO.StringIO(u'abc').getvalue() ---------------------------------------------------------------------- >Comment By: Georg Brandl (gbrandl) Date: 2006-10-13 19:24 Message: Logged In: YES user_id=849994 This was fixed with bug #1548891 a short while ago. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576443&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com