Quickest marshal.loads from unicode?
Terry Reedy
tjreedy at udel.edu
Fri Feb 21 16:44:04 EST 2003
"Giles Brown" <giles_brown at hotmail.com> wrote in message
news:57de9986.0302211019.47da29fc at posting.google.com...
> Alex's post has prompted me to give a more accurate description of
> my problem, which is that with encoding of unicode, for instance,
> utf-8 cannot cope with the binary data that you get in a marshalled
peice
> of code. Is there an encoding that will always work
> for any binary data "string" that a marshal.dumps call might
generate?
I believe (but not absolutely sure) that every 8-bit byte is a legal
latin-1 byte while at least one such is not a legal utf-8 byte (so
people have posted).
To test (untested):
bytes = 256*None
for i in range(256): bytes[i]=chr[i]
# now try to convert there and back and test equality.
Terry J. Reedy
More information about the Python-list
mailing list