-1

I got this simple but difficult problem in Python. For unknown reason with pypyjs, I got my binary buffer as u'\xd0\xcf\x11\xe0\xa1...'. By the look of it, I knew it would be alright if it is a binary stream of 'd0cf 11e0 a1...'. I wondered how do I do the conversion? What I need is this:

u'\xd0' -> d0 # integer value please
u'\xcf' -> cf
Ffisegydd
  • 43,058
  • 12
  • 125
  • 109
chfw
  • 4,126
  • 2
  • 22
  • 29

1 Answers1

3

Those are unicode code points. They aren't binary data at all, and you can't be receiving them like that; something is doing some conversion at your end.

You can certainly convert them to hex values:

hex(ord(u'\xd0'))

but I think your problem lies elsewhere in your code.

Daniel Roseman
  • 541,889
  • 55
  • 754
  • 786