The unicode of thumbs up is escaped as
\ud83d\udc4d
and \U0001f44d
in Javascript and Python separately (reference: http://www.charbase.com/1f44d-unicode-thumbs-up-sign)
Here's the scenario:
I receive as \ud83d\udc4d
from the front-end, and now I want to print it out at the server-side, how can I achieve that?
>>> print('\ud83d\udc4d')
UnicodeEncodeError: 'utf-8' codec can't encode character '\ud83d' in position 0: surrogates not allowed
>>> print('\U0001f44d')
To be more precise, I want to save the data into MongoDB by using pymongo
>>> from pymongo import MongoClient
>>> MongoClient().db.collection.insert({'thumbs_up': '\ud83d\udc4d'})
UnicodeEncodeError: 'utf-8' codec can't encode character '\ud83d' in position 0: surrogates not allowed
However, everything works fine if I convert it into \U0001f44d