When decoding term codes inside the JobStatusDisplay constructor, use the
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:13:02 +0000 (06:13 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:13:02 +0000 (06:13 -0000)
'replace' error handling scheme in order to avoid triggering a potential
UnicodeError. (trunk r12687)

svn path=/main/branches/2.1.6/; revision=12947

pym/_emerge/__init__.py

index 0a910928e3a62e8a74c6a4a59427fa5e0e763b09..32d07bc7a22bf941d1574d9a41a5ef740d6c7fc0 100644 (file)
@@ -9622,9 +9622,10 @@ class JobStatusDisplay(object):
                        for k, capname in self._termcap_name_map.iteritems():
                                term_codes[k] = self._default_term_codes[capname]
                        object.__setattr__(self, "_term_codes", term_codes)
+               encoding = sys.getdefaultencoding()
                for k, v in self._term_codes.items():
                        if not isinstance(v, str):
-                               self._term_codes[k] = v.decode()
+                               self._term_codes[k] = v.decode(encoding, 'replace')
 
        def _init_term(self):
                """