OSDN Git Service

AddonBundle.extract: Prepend "cp" to the OEM code page, as Python doesn't include...
authorJames Teh <jamie@jantrid.net>
Tue, 4 Sep 2012 01:10:28 +0000 (11:10 +1000)
committerJames Teh <jamie@jantrid.net>
Tue, 4 Sep 2012 01:10:28 +0000 (11:10 +1000)
Fixes inability to install add-ons on Arabic systems (and possibly other languages).

source/addonHandler.py

index 8cc6081..58f58af 100644 (file)
@@ -372,7 +372,7 @@ class AddonBundle(object):
                                        # #2505: Handle non-Unicode file names.
                                        # Most archivers seem to use the local OEM code page, even though the spec says only cp437.
                                        # HACK: Overriding info.filename is a bit ugly, but it avoids a lot of code duplication.
-                                       info.filename = info.filename.decode(str(winKernel.kernel32.GetOEMCP()))
+                                       info.filename = info.filename.decode("cp%d" % winKernel.kernel32.GetOEMCP())
                                z.extract(info, addonPath)
 
        @property