The _winreg module returns bytes which must be decoded to unicode, not encoded.
diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py
index d239057..6bf969f 100644
--- a/Lib/distutils/msvccompiler.py
+++ b/Lib/distutils/msvccompiler.py
@@ -93,10 +93,10 @@
     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