Mixing str and unicode leads to a UnicodeDecodeError
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
keystonemiddleware |
Fix Released
|
Undecided
|
Unassigned | ||
python-keystoneclient |
Invalid
|
Undecided
|
Cyril Roelandt |
Bug Description
In keystoneclient/
class S3Token(object):
...
def __call__(self, environ, start_response):
...
sometimes leads to the following error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 49: ordinal not in range(128).
This happens because "environ[
>>> x = "fooébar"
>>> x.replace('o', u'u')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
The "new_tenant_name" is Unicode because keystone returns the tenant id as a Unicode string. We should encode it before calling str.replace().
You may find a reproducible test case involving Swift and Swift3 at https:/
description: | updated |
Fix proposed to branch: master /review. openstack. org/161762
Review: https:/