encoding: detecting external format is mistaken?
Hi.
I need some help vs. encoding issues in external files.
LW 7.1.2 on Linux, with various 'UTF-8' everywhere in the locale's.
With the defaults in place, LW goes wrong with UTF-8 files, while
LATIN-1 and UNICODE/UTF-16 are ok.
Comparing the output of #'stream-external-format and the unix 'file'
command, using 3 copies of a sample file - encoded in resp. UTF-8,
LATIN-1 and UTF-16:
(mapcar #'(lambda (f)
(list
(let ((out (sys:run-shell-command (format nil "file ~A" f)
:wait nil :output :stream)))
(with-open-stream (out out) (read-line out)))
(with-open-file (ss f)
(stream-external-format ss))))
'("test.utf8.txt" "test.latin1.txt" "test.unicode.txt"))
yields:
(("test.utf8.txt: UTF-8 Unicode text" (:LATIN-1 :EOL-STYLE :LF))
("test.latin1.txt: ISO-8859 text" (:LATIN-1 :EOL-STYLE :LF))
("test.unicode.txt: Little-endian UTF-16 Unicode text" (:UNICODE :LITTLE-ENDIAN T :EOL-STYLE :LF)))
Note the :LATIN-1 suggestion for the UTF-8 file.
The 3 files: