The _winreg module returns bytes which must be decoded to unicode, not encoded.

This commit is contained in:
Christian Heimes 2007-11-17 11:46:54 +00:00
parent ad14d11a5e
commit d157e69777
1 changed files with 3 additions and 3 deletions

View File

@ -93,10 +93,10 @@ def read_values(base, key):
return d
def convert_mbcs(s):
enc = getattr(s, "encode", None)
if enc is not None:
dec = getattr(s, "decode", None)
if dec is not None:
try:
s = enc("mbcs")
s = dec("mbcs")
except UnicodeError:
pass
return s