Home  >  Article  >  php教程  >  php gvim中文乱码分析解决方法

php gvim中文乱码分析解决方法

WBOY
WBOYOriginal
2016-05-25 16:53:141830browse

开始研究gvim的配置文件(_vimrc),现在给大家看一下我产生乱码之前的配置,配置文件里enconding,fileeconding,fileecondings的含义:

encoding: gvim 内部使用的字符编码方式,包括 vim 的 buffer (缓冲区)、菜单文本、消息文本等。

用户手册上建议只在 .vimrc 中改变它的值,事实上似乎也只有在 .vimrc 中改变它的值才有意义。

fileencoding: gvim 中当前编辑的文件的字符编码方式,vim 保存文件时也会将文件保存为这种字符编码方式 (不管是否新文件都如此)。

fileencodings: gvim 启动时会按照它所列出的字符编码方式逐一探测即将打开的文件的字符编码方式,并且将 fileencoding 设置为最终探测到的字符编码方式。

因此最好将 unicode 编码方式放到这个列表的最前面,将拉丁语系编码方式 latin1 放到最后面。

其中:chinese 就是 cp963编码,只到这里我突然想起来,我的浏览里默认的字符集是 gbk的,而_vimrc里的设置编码是utf-8的,二者不对应.

colors desert  
set nobackup  
set guifont=courier_new:h12:cansi  
"处理文本中显示乱码  
set encoding=utf-8  
set fileencodings=chinese  
set fileencoding=chinese  
"处理菜单及右键菜单乱码  
source $vimruntime/delmenu.vim  
source $vimruntime/menu.vim  
"处理consle输出乱码  
language messages zh_cn.utf-8  
syntax enable  
syntax on


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn