diff configmix/py.py @ 166:b5ce9a8461bf

Use the filesystem encoding explicitely where appropriate.
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 14 Mar 2019 01:35:16 +0100
parents e2e8d21b4122
children b3b5ed34d180
line wrap: on
line diff
--- a/configmix/py.py	Thu Mar 14 00:21:30 2019 +0100
+++ b/configmix/py.py	Thu Mar 14 01:35:16 2019 +0100
@@ -18,7 +18,7 @@
     except ImportError:
         DictImpl = dict
 
-from .compat import PY2
+from .compat import PY2, u2fs
 
 
 __all__ = ["load"]
@@ -43,9 +43,7 @@
     gcontext = DictImpl()
     lcontext = DictImpl()
     if PY2:
-        filename2 = filename.encode(locale.getpreferredencoding())
-    if PY2:
-        execfile(filename2, gcontext, lcontext)
+        execfile(u2fs(filename, True), gcontext, lcontext)
     else:
         # "rb" mode allows Python to derive the encoding automatically
         with open(filename, "rb") as vf: