summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/ext/widestring.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ranger/ext/widestring.py b/ranger/ext/widestring.py
index dac54efd..88565b89 100644
--- a/ranger/ext/widestring.py
+++ b/ranger/ext/widestring.py
@@ -36,7 +36,14 @@ def string_to_charlist(string):
             if east_asian_width(c) in WIDE_SYMBOLS:
                 result.append('')
     else:
-        string = string.decode('utf-8', 'ignore')
+        try:
+            # This raised a "UnicodeEncodeError: 'ascii' codec can't encode
+            # character u'\xe4' in position 10: ordinal not in range(128)"
+            # for me once.  I thought errors='ignore' means IGNORE THE DAMN
+            # ERRORS but apparently it doesn't.
+            string = string.decode('utf-8', 'ignore')
+        except UnicodeEncodeError:
+            return []
         for c in string:
             result.append(c.encode('utf-8'))
             if east_asian_width(c) in WIDE_SYMBOLS: