From cbbe03247e70785404da4c9b70bf6fbaf61385a7 Mon Sep 17 00:00:00 2001
From: Arun Prakash Jana <engineerarun@gmail.com>
Date: Sat, 13 May 2017 10:27:49 +0530
Subject: [PATCH] Fix #23

---
 nnn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nnn.c b/nnn.c
index 5bad5d9..cedaff1 100644
--- a/nnn.c
+++ b/nnn.c
@@ -1592,13 +1592,13 @@ nochange:
 
 				/* If nlay doesn't handle it, open plain text
 				   files with vi, then try NNN_FALLBACK_OPENER */
-				strcpy(cmd, "file -b \"");
+				strcpy(cmd, "file -bi \"");
 				xstrlcpy(cmd + strlen(cmd), newpath, strlen(newpath) + 1);
 				strcat(cmd, "\"");
 				if (get_output(cmd, MAX_CMD_LEN) == NULL)
 					continue;
 
-				if (strstr(cmd, "ASCII text") != NULL) {
+				if (strstr(cmd, "text/") == cmd) {
 					exitcurses();
 					run = xgetenv("EDITOR", "vi");
 					spawn(run, newpath, NULL, 0);