about summary refs log tree commit diff stats
path: root/ranger/core/actions.py
diff options
context:
space:
mode:
Diffstat (limited to 'ranger/core/actions.py')
-rw-r--r--ranger/core/actions.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index ef616fd1..f4aec81a 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -639,7 +639,14 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 						data['foundpreview'] = False
 					elif exit == 2:
 						f = codecs.open(path, 'r', errors='ignore')
-						data[(-1, -1)] = f.read(1024 * 32)
+						try:
+							data[(-1, -1)] = f.read(1024 * 32)
+						except UnicodeDecodeError:
+							f.close()
+							f = codecs.open(path, 'r', encoding='latin-1',
+									errors='ignore')
+							data[(-1, -1)] = f.read(1024 * 32)
+						f.close()
 					else:
 						data[(-1, -1)] = None
 					if self.env.cf.realpath == path: