commit: a94b2f664714a33eeeb492efe87525fa9947a644 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> AuthorDate: Wed Sep 21 08:28:55 2022 +0000 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> CommitDate: Wed Sep 21 08:28:55 2022 +0000 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=a94b2f66
lddtree: specify utf-8 encoding with text files Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> lddtree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lddtree.py b/lddtree.py index 1f66b4d..3c9d66f 100755 --- a/lddtree.py +++ b/lddtree.py @@ -184,7 +184,7 @@ exec \\ """ wrappath = root + path os.rename(wrappath, wrappath + '.elf') - with open(wrappath, 'w') as f: + with open(wrappath, 'w', encoding='utf-8') as f: f.write(wrapper % replacements) os.chmod(wrappath, 0o0755) @@ -251,7 +251,7 @@ def ParseLdSoConf(ldso_conf, root='/', debug=False, _first=True): dbg_pfx = '' if _first else ' ' try: dbg(debug, '%sParseLdSoConf(%s)' % (dbg_pfx, ldso_conf)) - with open(ldso_conf) as f: + with open(ldso_conf, encoding='utf-8') as f: for line in f.readlines(): line = line.split('#', 1)[0].strip() if not line: