Hi,
today I (Python beginner) ran into a problem:^
I have a JPG file which contains some comment as unicode.
After reading in the string with s=file.read(70) from file offest 4
I get a string which is shown as
'UNICODE\\0x00\ \ox00K\\0x00o' and so forth in the debugger
(using Komodo).
How do I convert such string to a real unicode string and to
a windows_1252 or latin1 afterwards? I know it's a text with
german umlauts.
I tried this:
if rawdata[:7] == "UNICODE":
ustring = rawdata[7:]
us2 = unicode(ustring , "windows_12 52")
as2 = us2.encode("win dows_1252")
self.dic["ComUNI"] = rawdata
But all I get on each stage is a normal string with lots of \\0x00.
TIA
Bernd
today I (Python beginner) ran into a problem:^
I have a JPG file which contains some comment as unicode.
After reading in the string with s=file.read(70) from file offest 4
I get a string which is shown as
'UNICODE\\0x00\ \ox00K\\0x00o' and so forth in the debugger
(using Komodo).
How do I convert such string to a real unicode string and to
a windows_1252 or latin1 afterwards? I know it's a text with
german umlauts.
I tried this:
if rawdata[:7] == "UNICODE":
ustring = rawdata[7:]
us2 = unicode(ustring , "windows_12 52")
as2 = us2.encode("win dows_1252")
self.dic["ComUNI"] = rawdata
But all I get on each stage is a normal string with lots of \\0x00.
TIA
Bernd
Comment