[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: bashにうまく渡らない日本語がある?



From: 田中 信吾(TANAKA Shingo) <t_shingo@xxxxxxxx> さん曰く
Subject: bashにうまく渡らない日本語がある?
Message-ID: <wkelgavd4g.wl@xxxxxxxxxxxxxxxxx>
Date: Sat, 18 May 2002 03:32:47 +0900

> Wanderlustでsemiのmime-playを使って添付ファイルをfiberで起動させていますが、
> ファイル名によっては上手く動かなかったので、調べてみたところ、
> 次の問題に帰結しました。
> 
> (start-process "hoge" nil "bash" "-c" "fiber -s c:/tmp/あ.doc")
> 
> は正常に動くが、
> 
> (start-process "hoge" nil "bash" "-c" "fiber -s c:/tmp/描.doc")
> 
> は動かない(なにも反応しない)。

ぼくもそうなりました。

> これは一体なぜなのでしょうか。

正確なところはわからないのですが、sjis の

描 => 0x9560 の 2byte 目の 0x60 => `

でおかしくなるようです。

# 覗: 0x9460, 冒: 0x9660 でも同じでした。

> なお、bashのバージョンは2.05aとなっております。

ぼくが試した bash は cygwin 1.3.3 付属 の

$ bash --version 
GNU bash, version 2.05.0(7)-release (i686-pc-cygwin)

です。また、Win32 native な tcsh でも同様の症状になりました。

> などとしなければならず、mime-play.elを書き換えなければならないので
> 出来れば避けたいと思っているのですが。。。何か他の方法はありますでしょうか。

Meadow が悪いのではなく、bash とか tcsh が悪いのだと思います。

○動く方法
(start-process "hoge" nil "fiber" "-s" "c:/tmp/work/描.jpg")
;; とか
(let ((shell-file-name "cmdproxy.exe"))
  (start-process "hoge" nil
		 shell-file-name shell-command-switch
		 "fiber -s c:/tmp/work/描.jpg"))

○動かなかった方法
(let ((shell-file-name "bash.exe")) ;; とか
(let ((shell-file-name "tcsh.exe")) ;; とか
  (start-process "hoge" nil
		 shell-file-name shell-command-switch
		 "fiber -s c:/tmp/work/描.jpg"))

ので、mime-play.el を書き換えないで動かすには、

(defadvice mime-activate-mailcap-method (around use-cmdproxy activate)
  (let ((shell-file-name "cmdproxy.exe")
	(shell-command-switch "-c"))
    ad-do-it))

が動きそうです。(動作未確認)

けど、'("fiber" "-s" "c:/tmp/work/描.jpg") みたいに argument を
分けた方が素敵だなぁ。

-- 
白井秀行 (mailto:shirai@xxxxxxxxxxx)