>>> import characterentities as cent
>>> cent.encode(u'Hello <strong>\U0001f310</strong> !')
u'Hello <strong>🌐</strong>&nbsp;!'
>>> cent.encode(u'Hello <strong>\U0001f310</strong> !', False)
u'Hello <strong>🌐</strong> !'