views:

104

answers:

0

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).