Lispworks, Slime, and UTF-8
[this was sent to slime-devel, but I realized it may be of interest here as well] I managed to get UTF-8 communications with Lispworks working (on Linux). Unfortunately I had to use flexi-streams to do it, so it's probably not suitable for inclusion in Slime proper. It doesn't look like Lispworks's SOCKET-STREAMs are capable of external-format translation, which is too bad. At least now I can work on internationalized stuff without having my Slime session just die every time a non-ascii character tries to get printed! Hopefully this can help someone else as well. Index: swank-lispworks.lisp =================================================================== RCS file: /project/slime/cvsroot/slime/swank-lispworks.lisp,v retrieving revision 1.83 diff -u -r1.83 swank-lispworks.lisp --- swank-lispworks.lisp 22 Mar 2006 16:40:01 -0000 1.83 +++ swank-lispworks.lisp 4 May 2006 23:38:05 -0000 @@ -69,11 +69,17 @@ &key (external-format :iso-latin-1-unix) buffering timeout) (declare (ignore buffering timeout)) - (assert (eq external-format :iso-latin-1-unix)) - (let* ((fd (comm::get-fd-from-socket socket))) - (assert (/= fd -1)) - (make-instance 'comm:socket-stream :socket fd :direction :io - :element-type 'base-char))) + (let ((stream + (let* ((fd (comm::get-fd-from-socket socket))) + (assert (/= fd -1)) + (make-instance 'comm:socket-stream :socket fd :direction :io + :element-type (ecase external-format + (:iso-latin-1-unix 'base-char) + (:utf-8-unix '(unsigned-byte 8))))))) + (ecase external-format + (:iso-latin-1-unix stream) + (:utf-8-unix (flexi-streams:make-flexi-stream + stream :external-format :utf-8))))) (defun find-external-format (coding-system &optional default) (case coding-system -bcd