diff options
| author | bhagyashris <bhagyashri.shewale@nttdata.com> | 2016-05-24 17:07:00 +0530 |
|---|---|---|
| committer | bhagyashris <bhagyashri.shewale@nttdata.com> | 2017-01-24 12:39:20 +0530 |
| commit | a884becdd4a51f79821833ef97a4e66e6a129d24 (patch) | |
| tree | df61cdb1a1499695b694d48ac36631587cbe5884 /glanceclient/common/https.py | |
| parent | 99cbde26accbe5d066d9156cb39de9325f7116b9 (diff) | |
| download | python-glanceclient-a884becdd4a51f79821833ef97a4e66e6a129d24.tar.gz | |
Fix 'UnicodeEncodeError' for unicode values in url
Used '%' instead of format() because format() function doesn't
support the parsing of unicode codec like u'\U0001f693' in Python 2.
Python3 parse unicode codec with .format() correctly.
For example:
openstack@openstack-VirtualBox:~$ python2
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
>>> '{0}'.format(u'\U0001f693')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\U0001f693'
in position 0: ordinal not in range(128)
>>> '%s' % (u'\U0001f693')
u'\U0001f693'
NOTE: format() fuction will parse unicode codec in Python 2 after
prefixing 'u' like u'{0}.format(u'\U0001f693') but prfixing 'u'
at every place is not good, so it's better to use the '%' module.
Change-Id: I2fcca96a1356df08453e08487afb62dfec91ba9d
Closes-Bug: #1570766
Diffstat (limited to 'glanceclient/common/https.py')
0 files changed, 0 insertions, 0 deletions
