Emacs Lisp: how to set encoding for call-process
Posted
by RamyenHead
on Stack Overflow
See other posts from Stack Overflow
or by RamyenHead
Published on 2010-04-12T18:59:19Z
Indexed on
2010/04/12
19:03 UTC
Read the original article
Hit count: 565
I thought I knew how to set coding-system (or encoding): use process-coding-system-alist. Apparently, it's not working.
;; -*- coding: utf-8 -*-
(require 'cl)
(let
((process-coding-system-alist '("cygwin/bin/bash" . (utf-8-dos . utf-8-unix))))
(setq my-words (list "Lilo" "?_?" "_?" "?_" "?" "Stitch")
my-cygwin-bash "C:/cygwin/bin/bash.exe"
my-outbuf (get-buffer-create "*my cygwin bash echo test*")
)
(with-current-buffer my-outbuf
(goto-char (point-max))
(loop for word in my-words do
(insert (concat "echo " word "\n"))
(call-process my-cygwin-bash nil my-outbuf nil "-c" (concat "echo " word)))
)
(display-buffer my-outbuf)
)
Running the above code, the output is this:
echo Lilo
Lilo
echo ?_?
/usr/bin/bash: -c: line 0: unexpected EOF while looking for matching `"'
/usr/bin/bash: -c: line 1: syntax error: unexpected end of file
echo _?
/usr/bin/bash: -c: line 0: unexpected EOF while looking for matching `"'
/usr/bin/bash: -c: line 1: syntax error: unexpected end of file
echo ?_
/usr/bin/bash: $'echo \346\267\205?': command not found
echo ?
/usr/bin/bash: -c: line 0: unexpected EOF while looking for matching `"'
/usr/bin/bash: -c: line 1: syntax error: unexpected end of file
echo Stitch
Stitch
Anything sent to cygwin in unicode is failing (MS Windows, Korean).
© Stack Overflow or respective owner