From 964308467831d5e1bf93b29533d2cbe89102fd8c Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 1 Oct 2011 17:17:44 +0200 Subject: ext.widestring: fix for python2 verisons --- ranger/ext/widestring.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ranger/ext/widestring.py b/ranger/ext/widestring.py index a35071b3..cdb58719 100644 --- a/ranger/ext/widestring.py +++ b/ranger/ext/widestring.py @@ -47,13 +47,18 @@ def string_to_charlist(string): """Return a list of characters with extra empty strings after wide chars""" if not set(string) - ASCIIONLY: return list(string) - if not PY3: - string = string.decode('utf-8', 'ignore') result = [] - for c in string: - result.append(c) - if east_asian_width(c)[0] == 'W': - result.append('') + if PY3: + for c in string: + result.append(c) + if east_asian_width(c)[0] == 'W': + result.append('') + else: + string = string.decode('utf-8', 'ignore') + for c in string: + result.append(c.encode('utf-8')) + if east_asian_width(c)[0] == 'W': + result.append('') return result -- cgit 1.4.1-2-gfad0