Convert UTF-8 octets to unicode code points

后端 未结 4 1114
粉色の甜心
粉色の甜心 2020-12-09 05:42

I have a set of UTF-8 octets and I need to convert them back to unicode code points. How can I do this in python.

e.g. UTF-8 octet [\'0xc5\',\'0x81\'] should be con

4条回答
  •  独厮守ぢ
    2020-12-09 06:27

    >>> "".join((chr(int(x,16)) for x in ['0xc5','0x81'])).decode("utf8")
    u'\u0141'
    

提交回复
热议问题