2009年2月12日木曜日

Emacsのエンコーディング設定

多分、随分と前にPHPをUTF-8で書きたくて行った以下の設定のせいで、EUC-JPのPHPを編集する際に難儀していた。記述場所は~/.emacsである。

(modify-coding-system-alist 'file "\\.php$" 'utf-8)
(modify-coding-system-alist 'file "\\.inc$" 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)

全て行頭にセミコロン「;」を付けてコメントアウトし、Emacsを再起動したところ解決。EUC-JPのPHPを読んでも、ちゃんとエンコーディングを自動判断する様になった。

0 件のコメント: