diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2016-05-25 08:48:32 -0400 |
---|---|---|
committer | Brian Dolbec <dolsen@gentoo.org> | 2016-09-14 14:53:47 -0700 |
commit | 3f8f3263a316159359d4137d77c7be2c80fc9d57 (patch) | |
tree | e7de3c041ebfdb7bfeaee11261c96b1c7ee3e52c | |
parent | config.setcpv: add recursion assertion (diff) | |
download | portage-3f8f3263.tar.gz portage-3f8f3263.tar.bz2 portage-3f8f3263.zip |
pym/portage/util/locale.py: fix decoding for python2 plus some locales
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 <blueness@gentoo.org>
-rw-r--r-- | pym/portage/util/locale.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pym/portage/util/locale.py b/pym/portage/util/locale.py index 2a15ea1b1..093eb861f 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)), |