On 10/6/10 11:51 AM, Helmut Eller wrote:
- Raymond Toy [2010-10-06 12:27] writes:
For now option 2) is probably the simplest.
Ok. Can you give some hints on where to start looking at this?
read-message and write-message in swank-rpc.lisp.
The following change seems to work. I can now create a string with characters outside the bmp and slime doesn't die.
CL-USER> (map 'string #'code-char '(55296 56320 81 82 83)) "𐀀QRS"
I don't know what the "proper" way to integrate this would be, though. I'll need help with that.
Ray
#+cmu (defun codepoint-length (string) "Return the number of code points in the string. The string MUST be a valid UTF-16 string." (do ((len (length string)) (index 0 (1+ index)) (count 0 (1+ count))) ((>= index len) count) (multiple-value-bind (codepoint wide) (lisp:codepoint string index) (declare (ignore codepoint)) (when wide (incf index))))) #-cmu (defun codepoint-length (string) (length string))
(defun write-message (message package stream) (let* ((string (prin1-to-string-for-emacs message package)) (length (codepoint-length string))) (let ((*print-pretty* nil)) (format stream "~6,'0x" length)) (write-string string stream) (finish-output stream)))