-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
  • 51,807
  • 15
  • 147
  • 125
chfw
  • 4,502
  • 2
  • 29
  • 32

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
  • 588,541
  • 66
  • 880
  • 895