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