handlename's blog



emacsの設定を一からやり直してからか、 マルチバイト文字を入力した時に、 以下のようなエラーが表示されるようになってしまっていた。

These default coding systems were tried to encode text
in the buffer `AppVideoSuggestHint.pm':
  (undecided-unix (482 . 12354))
However, each of them encountered characters it couldn't encode:
  undecided-unix cannot encode these: ¤¢

Click on a character (or switch to this window by `C-x o'
and select the characters by RET) to jump to the place it appears,
where `C-u C-x =' will give information about it.

Select one of the safe coding systems listed below,
or cancel the writing with C-g and edit the buffer
   to remove or modify the problematic characters,
or specify any other coding system (and risk losing
   the problematic characters).

  euc-jp shift_jis iso-2022-jp euc-jis-2004 iso-2022-jp-2004 utf-8
  euc-kr gb2312 gb18030 gbk big5-hkscs hz-gb-2312 utf-7 utf-16
  utf-16be-with-signature utf-16le-with-signature utf-16be utf-16le
  japanese-shift-jis-2004 japanese-iso-7bit-1978-irv iso-2022-7bit
  utf-8-auto utf-8-with-signature eucjp-ms utf-8-hfs utf-8-nfd
  korean-cp949 japanese-cp932 utf-7-imap utf-8-emacs prefer-utf-8

M-x desciribe-coding-systemしてみると以下のような設定になっていた(一部抜粋)。

Priority order for recognizing coding systems when reading files:
  1. japanese-iso-8bit (alias: euc-japan-1990 euc-japan euc-jp)
  2. iso-2022-jp (alias: junet)
  3. japanese-shift-jis (alias: shift_jis sjis)
  4. iso-2022-jp-2
  5. utf-8 (alias: mule-utf-8)
  6. iso-2022-7bit
  7. iso-latin-1 (alias: iso-8859-1 latin-1)
  8. iso-2022-8bit-ss2
  9. emacs-mule
  10. raw-text
  11. in-is13194-devanagari (alias: devanagari)
  12. utf-8-auto
  13. utf-8-with-signature
  14. utf-16
  15. utf-16be-with-signature (alias: utf-16-be)
  16. utf-16le-with-signature (alias: utf-16-le)
  17. utf-16be
  18. utf-16le
  19. chinese-big5 (alias: big5 cn-big5 cp950)
  20. undecided



(set-language-environment "Japanese")
(prefer-coding-system 'utf-8-unix)
(setq buffer-file-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)

(prefer-coding-system 'utf-8-unix)

日本語ユーザーなので何も考えずにJapaneseを指定していたけれど、 これをやると上記のようにeuc-jpなどが優先されてしまうらしい。

ほかにもごちゃごちゃ設定していたけれどprefer-coding-systemだけ 指定しておけばよさそうなのでしばらくこれで様子を見ることにする。