Title: Problem with struct.unpack

Hi all,

I have the following question/problem:

>>> import struct
>>> strBuffer = u'\x00\xf0\x00\x00\x00\x00\x00\x00'
>>> print "%r" % strBuffer
u'\x00\xf0\x00\x00\x00\x00\x00\x00'
>>> (doorOpen,) = struct.unpack("1x1B6x", strBuffer)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf0' in position 1: ordinal not in range(128)

Why is that not working with an "u" string ?
If there is a 0x70 on the second byte, it works.

Any ideas ?

Thanks in advance

Martin

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to