Reputation: 5425
I'm trying to understand how encoding/decoding string works in Python, but I'm getting pretty confused.
If I've got a string like this:
'\x87\x0e)\xb9\xb0\x0f\t"c\xc7\xf1\x97B\xc6\x17\xee\xab\x1d\xbf\xc0\xd0\x06j\xc3'
Which type is this? Hex? And how to convert it to utf-8?
Upvotes: 0
Views: 774
Reputation: 7198
This way you can construct Unicode object out of this string
u='\x87\x0e)\xb9\xb0\x0f\t"c\xc7\xf1\x97B\xc6\x17\xee\xab\x1d\xbf\xc0\xd0\x06j\xc3'.decode('UTF16')
print type(u)
Upvotes: 1