ecl.exe>(load "d:\\temp\\foo.lsp" :external-format :CP936)
foo.lsp文件内容
;foo.lsp
(ext::stream-external-format-set *standard-input* :CP936)
(ext::stream-external-format-set *standard-output* :CP936)
(print (length "好吧"))
(print "TEST" *standard-output*)
(princ "好吧" *standard-output*)
(format t "~%汉字来也")
这个代码只能在文件中执行,如果在ecl console里逐行敲入这些代码,反而出现错误:
ECL (Embeddable Common-Lisp) 10.7.1
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.
Top level in: #<process TOP-LEVEL>.
> (ext::stream-external-format-set *standard-input* :CP936)
> (ext::stream-external-format-set *standard-output* :CP936)
> (format t "汉字来也")
鹤酪
NIL
> (format t "汉字来也")
鹤酪
NIL
>