Opened 10 years ago

Closed 10 years ago

#599 closed defect (fixed)

io encoding in RUN-PROGRAM

Reported by: hrapof Owned by: gb
Priority: normal Milestone: Clozure CL 1.4
Component: other Version: 1.3
Keywords: Cc:

Description

With "Version 1.3-r12839M (LinuxPPC32)" and Ubuntu 7.10, the following

(with-output-to-string

(stream) (ccl:run-program

"sh" `("-c"

,(format

nil "echo ~a | aspell -a --encoding=utf-8 --lang=~a" "dpg" "en"))

:output stream))

works as expected, while

(with-output-to-string

(stream) (ccl:run-program

"sh" `("-c"

,(format

nil "echo ~a | aspell -a --encoding=utf-8 --lang=~a" "сабака" "ru"))

:output stream))

does not (no suggestions are showed). Both worked five years ago on MacOS X, and in shell aspell works correctly. Some investigation showed that the problem is in the encoding RUN-PROGRAM uses for io. CCL is started with

-K utf-8 --eval '(setf *default-file-character-encoding* :utf-8)'

but it seems it's not enough...

Change History (5)

comment:1 follow-up: Changed 10 years ago by gb

  • Owner set to gb
  • Status changed from new to assigned

It's probably adequate for RUN-PROGRAM to take an :EXTERNAL-FORMAT argument and for that to default to the default terminal encoding; you certainly want some way to say "the process on the other end expects its standard input to be in some specifed format and produces output in that format." I'm not sure that that would handle all cases, but it seems reasonable to expect the external process to use the same conventions for input and output, and it seems reasonable to assume that if files/pipes/sockets/pathnames are specified as :input/:output/:error those streams are already in the specified encoding. If the latter assumption's wrong, then it seems that that's a separate issue.

comment:2 in reply to: ↑ 1 Changed 10 years ago by hrapof

Replying to gb:

It's probably adequate for RUN-PROGRAM to take an :EXTERNAL-FORMAT argument and for that to default to the default terminal encoding;

Totally agree!

files/pipes/sockets/pathnames are specified as :input/:output/:error those streams are already in the specified encoding.

Yes, and lisp string IMHO should be converted automagically, so that the following just worked:

(with-output-to-string (stream)

(with-input-from-string (s "сабака")

(ccl:run-program

"aspell" '("-a" "--encoding=utf-8" "--lang=ru") :input s :output stream)))

comment:3 Changed 10 years ago by rme

Looks like ticket:216 is about this same issue.

comment:4 Changed 10 years ago by rme

  • Milestone set to Clozure CL 1.4

comment:5 Changed 10 years ago by rme

  • Resolution set to fixed
  • Status changed from assigned to closed

should be fixed as of r13108

Note: See TracTickets for help on using tickets.