From ffa65600d253310aaac46bf390cad02f506a4cd4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 5 Aug 2009 18:07:45 +0000 Subject: [PATCH] Bug #280460 - Fix UnicodeDecodeError in env_update() due to non-unicode strings from getconfig(). TODO: Make getconfig() return unicode. svn path=/main/trunk/; revision=13921 --- pym/portage/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index c17b0c6d5..7b5d56048 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -685,6 +685,18 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None, # broken symlink or file removed by a concurrent process writemsg("!!! File Not Found: '%s'\n" % file_path, noiselevel=-1) continue + + # TODO: Make getconfig() return unicode. + unicode_config = {} + for k, v in myconfig.iteritems(): + if not isinstance(k, unicode): + k = unicode(k, encoding='utf8', errors='replace') + if not isinstance(v, unicode): + v = unicode(v, encoding='utf8', errors='replace') + unicode_config[k] = v + myconfig = unicode_config + del unicode_config + config_list.append(myconfig) if "SPACE_SEPARATED" in myconfig: space_separated.update(myconfig["SPACE_SEPARATED"].split()) -- 2.26.2