Reputation: 4077
I have used to pc for developing erlang program, one is mac os x 10.6, the other is mac os x 10.7.
In ".emacs"
file of both pc, it contain 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 input remark including Chinese characters in one pc and saved, and download to the other pc. The chinese characters can't be shown correctly. The same story for reverse operation.
I want to know how to check the current file's encoding type? Is there any command can do that?
Upvotes: 7
Views: 2798
Reputation: 1940
To modify the coding system in order to to read and write all ‘.txt’ files using the coding system chinese-iso-8bit, you can execute this Lisp expression:
(modify-coding-system-alist 'file "\\.txt\\'" 'chinese-iso-8bit)
For more informations see Recognizing Coding Systems.
Upvotes: 1
Reputation: 4804
you may also set
coding-system-for-write coding-system-for-read
Upvotes: 1
Reputation: 6625
I believe you're looking for buffer-file-coding-system
. M-x describe-variable
will tell you more about it, and you can set it by M-x eval-expression
and use (setq buffer-file-coding-system 'coding-system-i-want)
. That will set it for a single buffer; once you've got it working, you can add entries to file-coding-system-alist
to permanently set the option as you'd like.
Upvotes: 10