3

How can I specify external-format (for example (:crlf :|cp932|)) on ECL?

I want to write string to file with some encoding. So I type in my REPL like this:

(with-open-file (out "test.txt"
                 :direction :output
                 :external-format '(:crlf :|cp932|))
  (write-string "some string" out))

Then invoked debugger and it show this:

The function EXT:MAKE-ENCODING is undefined.
   [Condition of type UNDEFINED-FUNCTION]

This is an wrong way...? When the external-format is :utf-8, successfully written...

  • ECL version -- 15.3.7
  • OS -- Ubuntu 14.04
t-sin
  • 31
  • 1

2 Answers2

3

Based on §19.1.3. External formats in the manual, it looks like the appropriate symbol is actually named "CP819" and is in the package named by "EXT", so you'd use ext:cp819, not :|cp819|. You'd be able to use (:crlf ext:cp819), e.g.:

(with-open-file (out "test.txt"
                 :direction :output
                 :external-format '(:crlf ext:cp932))
  (write-string "some string" out))
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Thanks for answering. I'm sorry. Frankly, I read the manual and tried to use `(:crlf ext:cp932)`, but ECL returns `SIMPLE-ERROR` with a message `Cannot find the external symbol CP932 in #<"EXT" package>.` The reason why I use `:|cp932|` is, it is included in the return value of a function `ext:all-encodings`... – t-sin Apr 16 '15 at 15:49
  • @t-sin Hmm, I'm not an ECL user myself, so I didn't have a way to test this. This answer probably has the the same issue, then? Any chance that `ext:|cp932|` (so lowercase, but in the package) is there? Or `ext::cp932`? Etc? At any rate, this seems to be a discrepancy between the manual and the implementation, so you should probably get on the ECL mailing list/bug tracker/etc. – Joshua Taylor Apr 16 '15 at 16:05
  • @joshua-taylor thanks for advising! Umm, it's means, perhaps, my ECL building way is wrong... I'll ask it in ECL community. – t-sin Apr 20 '15 at 16:06
  • @t-sin BRPocock said that using `ext::cp932` worked; did it work for you? – Joshua Taylor Apr 20 '15 at 16:39
  • @joshua-taylor Sorry, I forgot to write... It did not work in my machine. My environment is not enough to build ECL maybe... – t-sin Apr 21 '15 at 05:22
1

Please fallback to ECL 15.2.21 or use git head - this is a bug introduced in 15.3.7