From: "Fredrik Lundh" <fredrik@pythonware.com> > thomas wrote: > > > Hehe, I don't want to put objects in structures, I just want to buid > > structures containing "Unicode strings". > > there is no such thing. > > what you want is a binary buffer with an *encoded* > unicode string. > > to get one, figure out what encoding you need (probably > utf-16-le), convert the string to a byte string using the > encode method, and store that byte string in your struct. > > def wu(str): > # encode unicode string for win32 apis > return str.encode("utf-16-le") > > struct.pack("32s", wu(u"VS_VERSION_INFO")) Thanks, works great. And utf-16-le *seems* to be what I want... Next question ;-), sorry for beeing off-topic for python-dev: How can I do the equivalent of u"some string" in terms of unicode("some string", encoding) Thanks, Thomas
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4