A
Achim Domma
Hi,
I want to pass raw binary data from a file to a COM object. I read the data
from file like this:
data = file('path_to_file','rb').read()
If passed to a COM object, data is converted to unicode in the way one would
expect for strings. I.e. a lot of zeros are filled in. I want each two
characters from data to be interpreted as one unicode character. I read the
docu about codecs but can not find a suitable codec. I also tried to read
the data like this:
data = codecs.open('path_to_file','rb','???').read()
I tried to use UCS2 for the ???, but this encoding does not exist. A posting
found via google supposes to use UTF-16 but this is not the same and raises
an error.
This shouldn't be a big problem, but I can figure out how to solve it. Can
anybody help?
regards,
Achim
I want to pass raw binary data from a file to a COM object. I read the data
from file like this:
data = file('path_to_file','rb').read()
If passed to a COM object, data is converted to unicode in the way one would
expect for strings. I.e. a lot of zeros are filled in. I want each two
characters from data to be interpreted as one unicode character. I read the
docu about codecs but can not find a suitable codec. I also tried to read
the data like this:
data = codecs.open('path_to_file','rb','???').read()
I tried to use UCS2 for the ???, but this encoding does not exist. A posting
found via google supposes to use UTF-16 but this is not the same and raises
an error.
This shouldn't be a big problem, but I can figure out how to solve it. Can
anybody help?
regards,
Achim