如何查看emacs中文件的编码? [英] How to see the file's encoding in emacs?
问题描述
我找不到当前文件的编码,如何显示?
I don't find the encoding of current file, how to display it?
您可以看到文件中有一些中文字符,但我不知道它的编码是什么。
You can see there are some Chinese characters in the file, but I don't know what the encoding it is.
有没有办法让它始终在emacs GUI上显示?
Is there any way to let it always show on the emacs GUI?
推荐答案
您可以在模式行中用 U
看到缓冲区是Unicode格式的,如果将鼠标放在其上,它将显示为工具提示当前缓冲区编码。
You can see with the U
in the mode-line that your buffer is in Unicode, if you put the mouse over it it will show in a tooltip the current buffer encoding.
- 您可以使用 Ch 查看当前编码 v
缓冲文件编码系统
RET - 您可以使用 Cx RET f $ li $更改下一次保存的整个缓冲区编码b
- 您还可以更改检测到的编码以强制使用另一种编码,并使用 Cx
重新加载文件 bd> RET r - 您只能使用 Cx RET c
- 还有其他可能,请查看 Cx RET Ch
- 如果文件混合编码混乱,您可以使用
Mx recode修复部分
-region - 如果您想自己进行诊断:
- 您可以使用
从字面上查找Mx查找文件
- 打开文本文件而无需任何解码或启发式操作,也可以更接近金属(十六进制编辑器)和
Mx hexl-find-file
- you can see the current encoding with C-hv
buffer-file-coding-system
RET - you can change the whole buffer encoding for next save with C-xRETf
- you can also change the detected encoding to force an other one and reload the file with C-xRETr
- you can set an encoding for the next I/O command only with C-xRETc
- there are some other possibilities, take a look on C-xRETC-h
- if the file is a mess with mixed encodings, you can fix portions with
M-x recode-region
- if you want to make a diagnostic by yourself:
- you can open a text file without any decoding or heuristic with
M-x find-file-literally
- or you can go closer to the metal (hex editor) with
M-x hexl-find-file
在缓冲区内,如果您对字符编码/细节感兴趣,请将其放在中文字符上,然后 Cu Cx = 会有所帮助。 (不带 C-u 的内容仅显示有关该字符的一些信息,并且编码不属于该字符。)
Inside a buffer, if you are interested by a character encoding / details, put the point on a chinese char and C-uC-x= will help. (The same without the C-u shows only a few informations about the character, and the encoding is not part of it.)
这篇关于如何查看emacs中文件的编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- you can open a text file without any decoding or heuristic with
- 您可以使用