From 581381acffbedfdc553b9643d47924bf44e32238 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 20 Jul 2009 23:50:20 +0000 Subject: Always pass encodings='utf_8' to codecs.open(), since otherwise it can return non-unicode strings (at least in some cases, observed with python-2.6.2). Don't use unicode in portage.util.getconfig() for now, since shlex doesn't seem to support it (spurious \0 characters). If we use unicode for config variables, it breaks shlex.split() calls on those variables due to the same issue (spurious \0 characters). svn path=/main/trunk/; revision=13845 --- bin/repoman | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/repoman b/bin/repoman index 3ea879c35..c8f32f4a4 100755 --- a/bin/repoman +++ b/bin/repoman @@ -590,7 +590,8 @@ for path in portdb.porttrees: desc_path = os.path.join(path, 'profiles', 'profiles.desc') try: - desc_file = codecs.open(desc_path, mode='r', errors='replace') + desc_file = codecs.open(desc_path, mode='r', + encoding='utf_8', errors='replace') except EnvironmentError: pass else: @@ -960,7 +961,8 @@ for x in scanlist: continue try: line = 1 - for l in codecs.open(checkdir+"/"+y, "r", "utf8"): + for l in codecs.open(os.path.join(checkdir, y), mode='r', + encoding='utf_8'): line +=1 except UnicodeDecodeError, ue: stats["file.UTF8"] += 1 -- cgit v1.2.3-1-g7c22