New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_get_all_query_args doesn't support non-ascii unicode strings. #2558

Closed
kouk opened this Issue Aug 26, 2014 · 0 comments

Comments

Projects
None yet
2 participants
@kouk
Contributor

kouk commented Aug 26, 2014

On Python 2.7 when trying to list keys in a bucket I ran into a bug when listing keys whose names contain non-ASCII characters. The actual problem I ran into was that the bucket.list method was failing due to an exception being [thrown by _get_all_query_args](https://github.com/boto/boto/blob/59ad5e21953a6d591f82def11aebd64808ab9559/boto/s3/bucket.py#L383), the problem being a unicode string with non-ascii characters (Greek in this case) that was being passed as themarker` parameter here. I added an extra test case for this and the unit test fails like this:

ERROR: test__get_all_query_args (tests.unit.s3.test_bucket.TestS3Bucket)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/kouk/code/boto/tests/unit/s3/test_bucket.py", line 106, in test__get_all_query_args
    qa = bukket._get_all_query_args(multiple_params)
  File "/home/kouk/code/boto/boto/s3/bucket.py", line 385, in _get_all_query_args
    urllib.parse.quote(value)
  File "/usr/local/lib/python2.7/urllib.py", line 1285, in quote
    return ''.join(map(quoter, s))
KeyError: u'\u03c7'
-------------------- >> begin captured logging << --------------------

My workaround for the moment (which I will send as a pull request) is to pass value.encode('utf-8') to urllib.parse.quote. Perhaps there is a better solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment