diff options
author | hut <hut@lepus.uberspace.de> | 2016-04-15 16:30:48 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2016-04-15 16:30:48 +0200 |
commit | d0193ba82f0a47121f02df82adf86da3b4c7c239 (patch) | |
tree | 9a59922d8cb52b8e68a562ffcea68270c234dba0 | |
parent | 730c359f69a7004dd0cf11bad4ae211444bb96f5 (diff) | |
download | ranger-d0193ba82f0a47121f02df82adf86da3b4c7c239.tar.gz |
core.loader: in safeDecode, don't crash on broken unicode
-rw-r--r-- | ranger/core/loader.py | 3 |
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 "" |