summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2016-04-15 16:30:48 +0200
committerhut <hut@lepus.uberspace.de>2016-04-15 16:30:48 +0200
commitd0193ba82f0a47121f02df82adf86da3b4c7c239 (patch)
tree9a59922d8cb52b8e68a562ffcea68270c234dba0
parent730c359f69a7004dd0cf11bad4ae211444bb96f5 (diff)
downloadranger-d0193ba82f0a47121f02df82adf86da3b4c7c239.tar.gz
core.loader: in safeDecode, don't crash on broken unicode
-rw-r--r--ranger/core/loader.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 2184d2b1..b1aabb53 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -260,7 +260,8 @@ def safeDecode(string):
         return string.decode("utf-8")
     except (UnicodeDecodeError):
         if HAVE_CHARDET:
-            return string.decode(chardet.detect(string)["encoding"])
+            codec = chardet.detect(string)["encoding"]
+            return string.decode(codec, 'ignore')
         else:
             return ""