Retrive unicode keys from the registry
"Martin v. Löwis"
martin at v.loewis.de
Fri Jan 16 18:10:47 EST 2004
Thomas Heller wrote:
> My understanding is that it's possible to convert any (for a certain
> definition of 'any) unicode string in a byte string (because the
> encoding for the byte string can be specified), but that it's impossible
> to convert a byte string into unicode unless the byte string's encoding
> is known.
>
> Maybe this only shows my un-understanding of unicode...
It certainly is. It is possible to create a registry key which the
"ANSI" API (RegQueryValueExA) cannot find - i.e. where you truly
need the "wide" API (RegQueryValueExW).
An example would be a registry key with Cyrillic, Greek, or Japanese
characters on your system. Encoding them as "mbcs" will convert those
characters into question marks (which is a bug in itself - Python
should rasise an exception instead).
Regards,
Martin
More information about the Python-list
mailing list