Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to set file character encoding by CentOS

Shulou Source: shulou.com Published: 2022-06-01 19:27:18 10月02日 Update

This article mainly shows you "CentOS how to set file character encoding", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "CentOS how to set file character encoding" this article.

Character coding (English: Character encoding), word set codes encode characters in a character set into an object in a specified set (for example, bit pattern, natural number sequence, 8-bit group, or electrical pulse) so that text can be stored in a computer and transmitted through a communication network. Common examples include coding the Latin alphabet into Morse code and ASCII. Where ASCII numbers letters, numbers, and other symbols and represents the integer in a 7-bit binary. An additional expanded bit is usually used to facilitate storage in a 1-byte manner.

1. View the character encoding of the file

# using file command### [root@ipython report] # file-- mime-encoding analysis.csvanalysis.csv: utf-8###using vim command### [root@ipython report] # vim analysis.csv:set fileencodingfileencoding=utf-8

2. Set file character encoding

# 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 above is all the contents of the article "how to set file character encoding in CentOS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Characters codes files content articles letters storage learning help binaries examples alphabets character sets bytes objects frequent common sequences numbers integers Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Microsoft NVidia Huawei macOS