首页 > 技术文章 > 查看文件编码格式以及更改编码

longzhongren 2015-03-11 20:03 原文

1.用file查看文件编码

[hadoop@Master ZhuJiangZaiXian]$ file vodall.csv
vodall.csv: UTF-8 Unicode (with BOM) text, with CRLF line terminators

2.用vi查看编码及更改编码格式

查看编码格式,用set fileencoding.
这是set fileencoding出来的结果
fileencoding
=utf-16le
设置文件的编码格式为utf-8
set fileencoding=utf-8
保存后退出,用file命令查看文件编码格式

[hadoop@Master ZhuJiangZaiXian]$ file temp.csv
temp.csv: UTF-8 Unicode (with BOM) text, with CRLF, CR line terminators

 程序猿必读

推荐阅读