Rev 4890: Bring in an AJB patch about Unicode handling with _encode_tuple. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-all-reconnect-819604

John Arbash Meinel john at arbash-meinel.com
Wed Sep 12 08:27:38 UTC 2012


At http://bazaar.launchpad.net/~jameinel/bzr/2.1-all-reconnect-819604

------------------------------------------------------------
revno: 4890
revision-id: john at arbash-meinel.com-20120912082718-rc0056el65dtvpdy
parent: john at arbash-meinel.com-20120912075951-mn4glmivewawsa9i
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-all-reconnect-819604
timestamp: Wed 2012-09-12 12:27:18 +0400
message:
  Bring in an AJB patch about Unicode handling with _encode_tuple.
  
  It would seem that at least in some places NoSuchFile gets the unicode path,
  which ends up wanting to turn the smart server request into a unicode stream,
  which ends up transmitting the 2-byte unicode chars as a regular buffer.
-------------- next part --------------
=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py	2012-09-12 07:59:51 +0000
+++ b/bzrlib/smart/protocol.py	2012-09-12 08:27:18 +0000
@@ -62,7 +62,13 @@
 
 def _encode_tuple(args):
     """Encode the tuple args to a bytestream."""
-    return '\x01'.join(args) + '\n'
+    joined = '\x01'.join(args) + '\n'
+    if type(joined) is unicode:
+        # XXX: We should fix things so this never happens!  -AJB, 20100304
+        mutter('response args contain unicode, should be only bytes: %r',
+               joined)
+        joined = joined.encode('ascii')
+    return joined
 
 
 class Requester(object):



More information about the bazaar-commits mailing list