<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.linuxsa.org/index.php?action=history&amp;feed=atom&amp;title=Linux%E4%B8%8Bvim%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95</id>
	<title>Linux下vim中文乱码的解决方法 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.linuxsa.org/index.php?action=history&amp;feed=atom&amp;title=Linux%E4%B8%8Bvim%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95"/>
	<link rel="alternate" type="text/html" href="https://wiki.linuxsa.org/index.php?title=Linux%E4%B8%8Bvim%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95&amp;action=history"/>
	<updated>2026-04-17T10:26:51Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://wiki.linuxsa.org/index.php?title=Linux%E4%B8%8Bvim%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95&amp;diff=580&amp;oldid=prev</id>
		<title>Evan：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxsa.org/index.php?title=Linux%E4%B8%8Bvim%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95&amp;diff=580&amp;oldid=prev"/>
		<updated>2019-10-14T13:48:56Z</updated>

		<summary type="html">&lt;p&gt;导入1个版本&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
你是不是遇到过 在服务器上 cat 文件 中文是显示正常的，但是一旦 vim 打开 里面的中文注释完全变成火星文的呢  哈哈 &lt;br /&gt;
==原因 哈哈==&lt;br /&gt;
*因为 &lt;br /&gt;
echo $LANG&lt;br /&gt;
C&lt;br /&gt;
*vim 读取需要编辑的文件，根据 fileencodings 中列出的字符编码方式逐一探测该文件编码方式。并设置 fileencoding 为探测到看起来是正确的 字符编码方式,如果没有找到合适的编码，就用latin-1(ASCII)编码打开。&lt;br /&gt;
&lt;br /&gt;
==一个非交互的解决方案==&lt;br /&gt;
&lt;br /&gt;
 sed -i &amp;#039;4a set encoding=utf-8&amp;#039; /etc/vimrc&lt;br /&gt;
&lt;br /&gt;
就不要再去改变什么 $LANG了  虽然程序哥喜欢这样做 哈哈 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==参考==&lt;br /&gt;
[http://www.cnblogs.com/joeyupdo/archive/2013/03/03/2941737.html vim中文乱码的解决方法]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[category:ops]] [[category:linux]]&lt;/div&gt;</summary>
		<author><name>Evan</name></author>
	</entry>
</feed>