summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 276f8852d..af908f041 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -3197,8 +3197,15 @@ class config(object):
"set a value; will be thrown away at reset() time"
if not isinstance(myvalue, basestring):
raise ValueError("Invalid type being used as a value: '%s': '%s'" % (str(mykey),str(myvalue)))
+
+ # Avoid potential UnicodeDecodeError exceptions later.
+ if not isinstance(mykey, unicode):
+ mykey = unicode(mykey, encoding='utf_8', errors='replace')
+ if not isinstance(myvalue, unicode):
+ myvalue = unicode(myvalue, encoding='utf_8', errors='replace')
+
self.modifying()
- self.modifiedkeys += [mykey]
+ self.modifiedkeys.append(mykey)
self.configdict["env"][mykey]=myvalue
def environ(self):