Emacs: current buffer coding system

I used erlang for the pc to develop, one was mac os x 10.6, the other was mac os x 10.7.

In the ".emacs" file of both pc it contains the following script

 ;;handle emacs utf-8 input (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (prefer-coding-system 'utf-8) 

But when I entered a note, including Chinese characters on one PC, and saved it, and booted onto another computer. Chinese characters cannot be displayed correctly. Same story for reverse work.

I want to know how to check the current type of file encoding? Can any team do this?

+6
source share
3 answers

I believe you are looking for buffer-file-coding-system . Mx describe-variable will tell you more about this, and you can set it to Mx eval-expression and use (setq buffer-file-coding-system 'coding-system-i-want) . This will set it for one buffer; as soon as you earn it, you can add entries to file-coding-system-alist to permanently set the parameter as you wish.

+9
source

you can also install

coding-system-for-writing coding-system for reading

+1
source

To change the encoding system to read and write all .txt files using the chinese-iso-8bit encoding system, you can execute this Lisp expression:

 (modify-coding-system-alist 'file "\\.txt\\'" 'chinese-iso-8bit) 

For more information, see Coding System Recognition .

+1
source

Source: https://habr.com/ru/post/921728/


All Articles