kozima #4631(2007/12/05 15:10 GMT) [ Common Lisp ] Rating0/0=0.00
よく知らなかったので調べながら……
文字列の変換は shiro さんの #4628 と同様にバイト列の変換にしています。ファイル入出力の際は :external-format を指定することで文字コード指定ができます。
いずれも処理系依存です。CLISP 2.38 で動作確認しました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
;;; 1 (defun sjis-to-euc-jp (bytes) (convert-string-to-bytes (convert-string-from-bytes bytes charset:shift-jis) charset:euc-jp)) ;;; 2 (defun sjis-to-euc-jp-file (from to) (with-open-file (in from :direction :input :external-format charset:shift-jis) (with-open-file (out to :direction :output :external-format charset:euc-jp) (do () ((null (listen in))) (write-line (read-line in) out)))))
Rating0/0=0.00-0+
[ reply ]
kozima
#4631()
[
Common Lisp
]
Rating0/0=0.00
よく知らなかったので調べながら……
文字列の変換は shiro さんの #4628 と同様にバイト列の変換にしています。ファイル入出力の際は :external-format を指定することで文字コード指定ができます。
いずれも処理系依存です。CLISP 2.38 で動作確認しました。
;;; 1 (defun sjis-to-euc-jp (bytes) (convert-string-to-bytes (convert-string-from-bytes bytes charset:shift-jis) charset:euc-jp)) ;;; 2 (defun sjis-to-euc-jp-file (from to) (with-open-file (in from :direction :input :external-format charset:shift-jis) (with-open-file (out to :direction :output :external-format charset:euc-jp) (do () ((null (listen in))) (write-line (read-line in) out)))))Rating0/0=0.00-0+
[ reply ]