Coding systemtable of Contents in Emacs
- 1. Coding System in Emacs
- 1.1. Environment is utf-8, file code is Utf-8
- 1.2. Environment is GBK, file code is GBK
- 1.3. Environment is GBK, file code is Utf-8
1The coding system in Emacs1.1Environment is utf-8, file encoding is Utf-8
If the Linux or Mac is utf-8 as the default encoding system, it is very simple, all settings are set to Utf-8.
1.2Environment is GBK, file encoding is GBK
If under Windows, the default encoding is GBK. The file encoding created is also GBK. All settings are set to GBK.
1.3Environment is GBK, file encoding is Utf-8
This is very troublesome, because the file name encoding is GBK, copy paste, etc., the system is related to the GBK. While programming, the file encoding is generally utf-8. At this point, the file name encoding is not the same as the content encoding. Therefore, in the use of gtags, it will cause, or the Chinese name of the file name can be displayed normally, but the content is garbled, or the content is normal, but the file name is garbled. No good solution has been thought of at the moment.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ENCODING; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(Add-to-list ' File-coding-system-alist '("\\.bat". gb2312))(Add-to-list ' File-coding-system-alist '("\\.html". Utf-8))(Add-to-list ' File-coding-system-alist '("\\.js". Utf-8))(Add-to-list ' File-coding-system-alist '("\\.php". Utf-8))(Add-to-list ' File-coding-system-alist '("\\.TCL". Utf-8))(Add-to-list ' File-coding-system-alist '("\\.el". Utf-8))(Prefer-coding-system ' Utf-8)(Set-default-coding-systems ' Utf-8)(Set-terminal-coding-system ' Utf-8)(Set-keyboard-coding-system ' Utf-8)*hideshowvis* (unless (EQ System-type ' windows-nt) (Set-selection-coding-system ' Utf-8))(Set-clipboard-coding-system ' Utf-8)(Setq-defaultBuffer-file-coding-system ' Utf-8);; Chinese filenames in shell commands.*hideshowvis* ( when (EQ System-type ' windows-nt) (setqFile-name-coding-system ' Gbk-dos) (Set-clipboard-coding-system ' Gbk-dos) (setqDefault-process-coding-system '(Gbk-dos. Gbk-dos)) *hideshowvis* (Set-default ' Process-coding-system-alist '*hideshowvis* (("Find"Gbk-dos. Gbk-dos) ("Global"Gbk-dos. Gbk-dos) ("Gtags"Gbk-dos. Gbk-dos) ("Ctags"Gbk-dos. Gbk-dos) ("AG"Gbk-dos. Gbk-dos) ("Java"Gbk-dos. Gbk-dos) ("Javac"Gbk-dos. Gbk-dos) )))
DATE:2016-08-17 17:30
created:2016-12-20 Tuesday 23:41
Validate
The coding system in Emacs