diff options
author | hut <hut@lavabit.com> | 2011-10-01 17:17:44 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2011-10-01 17:17:44 +0200 |
commit | 964308467831d5e1bf93b29533d2cbe89102fd8c (patch) | |
tree | b7f8f122373bd1267279350df17f15ee78127759 | |
parent | a5737effc280565ed8530c453ceea6ddc126f839 (diff) | |
download | ranger-964308467831d5e1bf93b29533d2cbe89102fd8c.tar.gz |
ext.widestring: fix for python2 verisons
-rw-r--r-- | ranger/ext/widestring.py | 17 |
1 files 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 |