17
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

EmacsでとにかくUTF-8を使う

Posted at

ruby-modeでコードを書いててたまに思い出したように日本語をコード内で使うと# -*- coding: undecided -*-なんてのが気づいたらヘッダーにあるせいで unknown encoding name: undecided (ArgumentError)と出て「ふぁーーーっく」と言う気分になるので、とりあえず何でもかんでもUTF-8だと仮定して読むこむことにした。

~/.emacs.d/inits/00-env.el
(prefer-coding-system 'utf-8)
(setq coding-system-for-read 'utf-8)
(setq coding-system-for-write 'utf-8)

これでOK。

別の文字エンコーディングで開きたい時は revert-buffer-with-coding-system とか使ってかえましょう。

参考

encoding - Change Emacs Default Coding System - Stack Overflow
http://stackoverflow.com/questions/1785200/change-emacs-default-coding-system

17
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?