summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-01 17:17:44 +0200
committerhut <hut@lavabit.com>2011-10-01 17:17:44 +0200
commit964308467831d5e1bf93b29533d2cbe89102fd8c (patch)
treeb7f8f122373bd1267279350df17f15ee78127759
parenta5737effc280565ed8530c453ceea6ddc126f839 (diff)
downloadranger-964308467831d5e1bf93b29533d2cbe89102fd8c.tar.gz
ext.widestring: fix for python2 verisons
-rw-r--r--ranger/ext/widestring.py17
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
 
 
149'>149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177