5

emacs内のスライムプロンプトから実行するとエラーなしで実行されるコードがあります。プロンプトから sbcl を開始すると、次のエラーが発生しました。

* (ei:proc-file "BRAvESP000.log" "lixo")

debugger invoked on a SB-INT:STREAM-ENCODING-ERROR:
  :UTF-8 stream encoding error on
  #<SB-SYS:FD-STREAM for "file /Users/arademaker/work/IBM/scolapp/lixo"
    {10049E8FF3}>:

    the character with code 55357 cannot be encoded.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [OUTPUT-NOTHING    ] Skip output of this character.
  1: [OUTPUT-REPLACEMENT] Output replacement string.
  2: [ABORT             ] Exit debugger, returning to top level.

(SB-IMPL::STREAM-ENCODING-ERROR-AND-HANDLE #<SB-SYS:FD-STREAM for "file /Users/arademaker/work/IBM/scolapp/lixo" {10049E8FF3}> 55357)
0]

謎なのは、どちらの場合も同じ sbcl 1.1.8 と同じマシン、Mac OS 10.8.4 を使用していることです。何か案が?

コード:

(defun proc-file (filein fileout &key (fn-convert #'identity))
  (with-open-file (fout fileout
                   :direction :output
                   :if-exists :supersede
                   :external-format :utf8)
    (with-open-file (fin filein :external-format :utf8)
      (loop for line = (read-line fin nil)
        while line
        do 
        (handler-case
        (let* ((line (ppcre:regex-replace "^.*{jsonTweet=" line "{\"jsonTweet\":"))
               (data (gethash "jsonTweet" (yason:parse line))))
          (yason:encode (funcall fn-convert (yason:parse data)) fout)
          (format fout "~%"))
          (end-of-file ()
        (format *standard-output* "Error[~a]: ~a~%" filein line)))))))
4

1 に答える 1