From: "Anthony G. Basile" <bluen...@gentoo.org>

When using python2 with some locales, like turkish, chr() is passed values not 
in
range(128) which cannot be decoded as ASCII, thus throwing a UnicodeDecodeError
exception.  We use _unicode_decode() from portage.util to address this.

Signed-off-by: Anthony G. Basile <bluen...@gentoo.org>
---
 pym/portage/util/locale.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/locale.py b/pym/portage/util/locale.py
index 2a15ea1..093eb86 100644
--- a/pym/portage/util/locale.py
+++ b/pym/portage/util/locale.py
@@ -15,7 +15,7 @@ import textwrap
 import traceback
 
 import portage
-from portage.util import writemsg_level
+from portage.util import _unicode_decode, writemsg_level
 from portage.util._ctypes import find_library, LoadLibrary
 
 
@@ -62,7 +62,7 @@ def _check_locale(silent):
                        "as LC_CTYPE in make.conf.")
                msg = [l for l in textwrap.wrap(msg, 70)]
                msg.append("")
-               chars = lambda l: ''.join(chr(x) for x in l)
+               chars = lambda l: ''.join(_unicode_decode(chr(x)) for x in l)
                if uc != ruc:
                        msg.extend([
                                "  %s -> %s" % (chars(lc), chars(ruc)),
-- 
2.7.3


Reply via email to