mirror of
https://github.com/python/cpython.git
synced 2024-11-27 20:04:41 +08:00
The _winreg module returns bytes which must be decoded to unicode, not encoded.
This commit is contained in:
parent
ad14d11a5e
commit
d157e69777
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user