I have used to pc for developing erlang program, one is mac os x 10.6, the other is mac os x 10.7.
我曾经使用pc来开发erlang程序,一个是mac os x 10.6,另一个是mac os x 10.7。
In ".emacs"
file of both pc, it contain the following script
在”。这两款电脑的emacs文件都包含如下脚本。
;;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?
我想知道如何检查当前文件的编码类型?有什么命令可以做到吗?
3 个解决方案
#1
9
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.
我相信你正在寻找的是缓冲文件编码系统。M-x描述变量将会告诉你更多关于它的信息,你可以通过M-x的eval-expression和use (setq bufferfile - codingsystem ' codingsystem -i-want)来设置它。这将为一个缓冲区设置;一旦你有了它的工作,你就可以添加条目到文件-编码-系统主义者来永久地设置你想要的选项。
#2
1
you may also set
你也可以设置
coding-system-for-write coding-system-for-read
coding-system-for-write coding-system-for-read
#3
1
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:
修改编码系统,以便阅读和编写所有的代码。txt文件使用中文-iso-8bit的编码系统,你可以执行这个Lisp表达式:
(modify-coding-system-alist 'file "\\.txt\\'" 'chinese-iso-8bit)
For more informations see Recognizing Coding Systems.
有关更多信息,请参见识别编码系统。
#1
9
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.
我相信你正在寻找的是缓冲文件编码系统。M-x描述变量将会告诉你更多关于它的信息,你可以通过M-x的eval-expression和use (setq bufferfile - codingsystem ' codingsystem -i-want)来设置它。这将为一个缓冲区设置;一旦你有了它的工作,你就可以添加条目到文件-编码-系统主义者来永久地设置你想要的选项。
#2
1
you may also set
你也可以设置
coding-system-for-write coding-system-for-read
coding-system-for-write coding-system-for-read
#3
1
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:
修改编码系统,以便阅读和编写所有的代码。txt文件使用中文-iso-8bit的编码系统,你可以执行这个Lisp表达式:
(modify-coding-system-alist 'file "\\.txt\\'" 'chinese-iso-8bit)
For more informations see Recognizing Coding Systems.
有关更多信息,请参见识别编码系统。