CentOS设置文件字符编码的方法

admin Linux运维评论465字数 400阅读模式

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

: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!

版权声明:文章图片资源来源于网络,如有侵权,请留言删除!!!
admin
  • 本文由 发表于 2021年9月28日 17:38:36
  • 转载请务必保留本文链接:https://www.58pxe.com/7772.html
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: