commit: 3f8f3263a316159359d4137d77c7be2c80fc9d57
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 12:48:32 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Sep 14 21:53:47 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3f8f3263
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 <AT> 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)),