Friday, 13 September 2013

python string unicode issue

python string unicode issue

Here is my code
result = " '{0}' is unicode or something: ".format(mongdb['field'])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in
position 27: ordinal not in range(128)
It looks like a string I read from mongodb contains unicode. And it throws
this error. How to fix it to concatenate this unicde with custom string
'is unicode or something:' ?
Thanks in advance

No comments:

Post a Comment