no struct.pack for unicode strings?
Gerhard Häring
gerhard.haering at gmx.de
Fri Oct 18 03:11:03 EDT 2002
Radovan Garabik wrote in comp.lang.python:
> Why there is no format to pack/unpack unicode strings?
> Or am I missing something?
The binary representation of Unicode strings is implementation
defined.
> My application needs to struct.pack unicode strings, to save them
> into a file which can be then read by a C extension module where I
> need to access characters of the string (as Py_UNICODE).
I'd recommend to convert to and from utf-8 encoded bytestrings.
-- Gerhard
More information about the Python-list
mailing list