diff --git a/src/modules/client/transport/transport.py b/src/modules/client/transport/transport.py index 08890a5e5..f8246e10b 100644 --- a/src/modules/client/transport/transport.py +++ b/src/modules/client/transport/transport.py @@ -1686,7 +1686,7 @@ def _prefetch_manifests_list(self, mxfr, mlist, excludes=misc.EmptyI): continue try: - mf = open(dl_path) + mf = open(dl_path, "r", encoding="UTF-8") mcontent = mf.read() mf.close() manifest.FactoredManifest(fmri, @@ -1776,7 +1776,7 @@ def _verify_manifest(self, fmri, mfstpath=None, content=None, pub=None): return False if mfstpath: - mf = open(mfstpath) + mf = open(mfstpath, "r", encoding="UTF-8") mcontent = mf.read() mf.close() elif content is not None: diff --git a/src/modules/manifest.py b/src/modules/manifest.py index 979cc95dd..ef629c0a5 100644 --- a/src/modules/manifest.py +++ b/src/modules/manifest.py @@ -1229,7 +1229,7 @@ def search_dict(file_path, excludes, return_line=False, log = lambda x: None try: - file_handle = open(file_path, "r") + file_handle = open(file_path, "r", encoding="UTF-8") except EnvironmentError as e: if e.errno != errno.ENOENT: raise @@ -1364,7 +1364,7 @@ def store(self, mfst_path): e.filename) raise - mfile = os.fdopen(fd, "w") + mfile = os.fdopen(fd, "w", encoding="UTF-8") # # We specifically avoid sorting manifests before writing @@ -1668,7 +1668,7 @@ def __storebytype(self): except EnvironmentError as e: raise apx._convert_error(e) - f = os.fdopen(fd, "w") + f = os.fdopen(fd, "w", encoding="UTF-8") try: for a in acts: f.write("{0}\n".format(a)) @@ -1695,7 +1695,7 @@ def create_cache(name, refs): try: fd, fn = tempfile.mkstemp(dir=t_dir, prefix=name + ".") - with os.fdopen(fd, "w") as f: + with os.fdopen(fd, "w", encoding="UTF-8") as f: f.writelines(refs()) os.chmod(fn, PKG_FILE_MODE) portable.rename(fn, self.__cache_path(name)) @@ -1745,7 +1745,7 @@ def __load_cached_data(self, name): if os.path.exists(mpath): # we have cached copy on disk; use it try: - with open(mpath, "r") as f: + with open(mpath, "r", encoding="UTF-8") as f: self._cache[name] = [ a for a in ( @@ -1830,7 +1830,7 @@ def gen_actions_by_type(self, atype, attr_match=None, excludes=EmptyI): attr_match = _compile_fnpats(attr_match) try: - with open(mpath, "r") as f: + with open(mpath, "r", encoding="UTF-8") as f: for l in f: a = actions.fromstr(l.rstrip()) if (excludes and @@ -1889,7 +1889,7 @@ def __load_attributes(self): mpath = self.__cache_path("manifest.set") if not os.path.exists(mpath): return False - with open(mpath, "r") as f: + with open(mpath, "r", encoding="UTF-8") as f: for l in f: a = actions.fromstr(l.rstrip()) if not self.excludes or \