In PY3, all strings are sequences of unicode characters. In PY2,
a string may be of type str or of type unicode. Six provides
simple utilities for wrapping over differences between Python 2
and Python 3.[1] So using six.text_type instead of str to be more
compatible.
Python 2.x automatically encode the unicode with sys.getdefaultencoding(),
which is usually 'ascii'. If there are some non-ASCII characters, it can
raise UnicodeeEncodeError. Add a unit test that use unicode string to test
PartitionCoordinator to check if there have the same error in the bug.
Reviewed: https:/ /review. openstack. org/368418 /git.openstack. org/cgit/ openstack/ ceilometer/ commit/ ?id=e3752c1e485 f885d982725e3c6 ece2eb6f2bdc36
Committed: https:/
Submitter: Jenkins
Branch: master
commit e3752c1e485f885 d982725e3c6ece2 eb6f2bdc36
Author: Hanxi <email address hidden>
Date: Sun Sep 11 17:25:01 2016 +0800
Fix UnicodeEncodeError in Ceilometer polling
In PY3, all strings are sequences of unicode characters. In PY2, ncoding( ), rror. Add a unit test that use unicode string to test ordinator to check if there have the same error in the bug.
a string may be of type str or of type unicode. Six provides
simple utilities for wrapping over differences between Python 2
and Python 3.[1] So using six.text_type instead of str to be more
compatible.
Python 2.x automatically encode the unicode with sys.getdefaulte
which is usually 'ascii'. If there are some non-ASCII characters, it can
raise UnicodeeEncodeE
PartitionCo
[1] https:/ /pythonhosted. org/six/ #six.text_ type
Change-Id: Ic52c805b81e53a 632a61ddcd3e865 2b5849d913d
Closes-Bug: #1621305