Problem with struct.unpack
Kuner Martin
martin.kuner at thomson.net
Fri Jul 1 06:53:25 EDT 2005
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050701/1822968b/attachment.html>
More information about the Python-list
mailing list