首页 > 窍门 > 科技数码

CentOS设置文件字符编码的方法(centos7设置中文编码)

来源: 更新时间:2023-09-03 00:19:55
The Beginning

  1、查看文件字符编码

  ###using file command###

  [root@ipython report]# file --mime-encoding analysis.csv

  analysis.csv: utf-8

  ###using vim command###

  [root@ipython report]# vim analysis.csv

拥有帝国一切,皆有可能。欢迎访问phome.net

  :set fileencoding

  fileencoding=utf-8

  2、设置文件字符编码

  ####using iconv command####

  syntax:

  iconv -f old_encoding -t new_encoding filename

  ###example###

  [root@ipython report]# iconv -f utf-8 -t gbk analysis.csv > new_analysis.csv

  ###using vim command###

  :set fileencoding=gbk

  :wq!

THE END

TAG:字符  文件  wq  

猜你喜欢

相关文章