I have a set of unicode numbers , I need to convert them to UTF-8 and print the result in to split them in to hex values.
eg: Unicode 0x80 should be converted to UTF-8 and printed as (0xc2,0x80)
I tried following
str(unichr(0x80).encode('utf-8')).split(r'\x')[0]
But it does get split in to [‘c2′,’80’]. But it gives me [‘\xc2\x80’].
I need this for code generation.
To generate a list of the hexadecimal values of the characters in your UTF8-encoded string, use the following: