How can I print decoded_json
below so that the emoji appears?
>>> raw_json = '"smile "'
>>> decoded_json = cjson.decode(raw_json)
>>> decoded_json
u'smile \xf0\x9f\x98\x8a'
>>> print decoded_json
smile ð
>>> print 'smile \xf0\x9f\x98\x8a' # u' removed
smile
It seems like cjson.decode
returns a u'
unicode string. That unicode string has the correct byte representation of the emoji, but when the string is printed some other character appears instead of the emoji.
When I print the same string with u'
removed, it works.
Is there something I can do to decoded_json
so that it will print the emoji?