Fix decoding of evaluation results to support multibyte characters
Symptom: (sclang-eval-sync "\"ö\"") evaluates to "ö" After this patch: (sclang-eval-sync "\"ö\"") => "ö" This was tricky to figure out, so here is a bit of background. scel uses a so-called command FIFO to send (amongst other things) evaluation results to Emacs. This FIFO uses a pascal-string (32bit string length followed by character data) to send Lisp to Emacs. The command process coding system is already set to 'no-conversion on the Emacs side to avoid crippling the int32 at the beginning of every string. However, the read-from-string call in sclang-command-process-filter implicitly converts the unibyte string received from the process to a multibyte string, without doing proper conversion. The right function to use here is string-as-multibyte, which does the correct conversion.
This commit is contained in:
parent
da28459931
commit
7285fb3358
1 changed files with 2 additions and 1 deletions
|
@ -444,7 +444,8 @@ Change this if \"cat\" has a non-standard name or location."
|
||||||
(while (and (> (length string) 3)
|
(while (and (> (length string) 3)
|
||||||
(>= (length string)
|
(>= (length string)
|
||||||
(setq end (+ 4 (sclang-string-to-int32 string)))))
|
(setq end (+ 4 (sclang-string-to-int32 string)))))
|
||||||
(sclang-handle-command-result (car (read-from-string string 4 end)))
|
(sclang-handle-command-result
|
||||||
|
(read (string-as-multibyte (substring string 4 end))))
|
||||||
(setq string (substring string end))))
|
(setq string (substring string end))))
|
||||||
(setq sclang-command-process-previous string))
|
(setq sclang-command-process-previous string))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue