When decoding term codes inside the JobStatusDisplay constructor, use the
authorZac Medico <zmedico@gentoo.org>
Sun, 22 Feb 2009 23:39:03 +0000 (23:39 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 22 Feb 2009 23:39:03 +0000 (23:39 -0000)
'replace' error handling scheme in order to avoid triggering a potential
UnicodeError.

svn path=/main/trunk/; revision=12687

pym/_emerge/__init__.py

index 9120e71b5c8b8399972cd419ec81f769666cf092..3b20718b1005f8f97f3de786d65eb317fe99449f 100644 (file)
@@ -9638,9 +9638,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):
                """