Common Lisp | |
CCL の -K オプションで *terminal-io* で文字コードを指定しなければいけなかったようです。
昨日から悩んでいるんですが、 x86_64 の Clozure CL (Version 1.6-r14471M) で以下のコードで出力が文字化けをするのが何故なのかがわかりません。Twitter で @l_libraさん にもアドバイスをいただいたのですが、解決に至ってないです。
;; sample.lisp (defun run () (with-open-file (input "/tmp/sample.txt" :direction :input :external-format :utf-8) (format t "~A~%" (read-line input))))
shinnya@quad% nkf -g /tmp/sample.txt UTF-8 shinnya@quad% cat /tmp/sample.txt こんにちは! shinnya@quad% rlwrap ccl ; Loading system definition from /home/shinnya/.ccl/systems/asdf-install.asd into #<Package "ASDF0"> ; Registering #<SYSTEM ASDF-INSTALL> as ASDF-INSTALL ;;; ASDF-Install version 0.6.14 Welcome to Clozure Common Lisp Version 1.6-r14471M (LinuxX8664)! ? (load "/tmp/sample.lisp") #P"/tmp/sample.lisp" ? (run) NIL ? (quit) shinnya@quad% sbcl --load /tmp/sample.lisp --eval '(progn (run) (quit))' This is SBCL 1.0.44, an implementation of ANSI Common Lisp. More information about SBCL is available at <http://www.sbcl.org/>. SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. ; loading system definition from ; /usr/lib/sbcl/sb-bsd-sockets/sb-bsd-sockets.asd into #<PACKAGE "ASDF0"> ; registering #<SYSTEM SB-BSD-SOCKETS> as SB-BSD-SOCKETS ; registering #<SYSTEM SB-BSD-SOCKETS-TESTS> as SB-BSD-SOCKETS-TESTS ; loading system definition from /usr/lib/sbcl/sb-posix/sb-posix.asd into ; #<PACKAGE "ASDF0"> ; registering #<SYSTEM SB-POSIX> as SB-POSIX ; registering #<SYSTEM SB-POSIX-TESTS> as SB-POSIX-TESTS こんにちは!