Fix the case of files of length 1 or 2.
authorFrancois-Rene Rideau <fare@tunes.org>
Sun, 29 Apr 2012 03:25:28 +0000 (23:25 -0400)
committerFrancois-Rene Rideau <fare@tunes.org>
Sun, 29 Apr 2012 03:25:28 +0000 (23:25 -0400)
autodetect.lisp

index 5205c08..ce502df 100644 (file)
                           ;; UTF-16, big-endian.
                           (setf initial-encoding :utf-16be))
                          (t
-                          (setf initial-encoding :latin1)))))
+                          (setf initial-encoding :utf-8-auto)))))
+                ((= available 1)
+                 (setf initial-encoding (if (< (aref buffer 0) #x80) :ascii :latin1)))
                 (t
                  ;; Empty file - just use the default.
                  (setf initial-encoding :default))))))