February 10, 2008
Another Unicode Patch to Boto
Index: boto/s3/key.py =================================================================== --- boto/s3/key.py (revision 492) +++ boto/s3/key.py (working copy) @@ -267,7 +267,7 @@ def get_file(self, fp, headers=None, cb=None, num_cb=10): path = '/%s/%s' % (self.bucket.name, self.name) - path = urllib.quote(path) + path = urllib.quote(path.encode('utf-8')) resp = self.bucket.connection.make_request('GET', path, headers) if resp.status < 199 or resp.status > 299: raise S3ResponseError(resp.status, resp.reason)
If you have unicode characters in your strings that out of the 128 ascii
character range, then trying to access that path with urllib could cause you
some trouble. As I did with my previous patch to boto on this
I solved this problem by encoding the string that was passed to urllib to
utf-8 and all was well.