Unicode getting in the way...
Dan Maas
dmaas at dcine.com
Thu Mar 8 00:19:45 EST 2001
Python 2.0. All I want to do is construct and parse simple
binary packets. e.g.
foo = "abcd" + struct.pack("B", 254)
foo += "efg%s" % "lalala"
At some random point in my code, foo changes from being a
'string' object to a 'unicode' object. Subsequent attempts
to manipulate foo fail with a UnicodeError (ASCII decoding
error, ordinal not in range(128)).
How can I stop this from happening? I just need raw 8-bit
strings everywhere!
Thanks,
Dan
More information about the Python-list
mailing list