diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-08-05 18:07:45 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-08-05 18:07:45 +0000 |
commit | ffa65600d253310aaac46bf390cad02f506a4cd4 (patch) | |
tree | a5733a4f33cf07193ee455bf6befd8f91c4967d1 | |
parent | 45bb6fdcd82bb0c6f39d01bb63bb8526eb0d56f4 (diff) | |
download | portage-ffa65600d253310aaac46bf390cad02f506a4cd4.tar.gz portage-ffa65600d253310aaac46bf390cad02f506a4cd4.tar.bz2 portage-ffa65600d253310aaac46bf390cad02f506a4cd4.zip |
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
-rw-r--r-- | pym/portage/__init__.py | 12 |
1 files changed, 12 insertions, 0 deletions
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()) |