How can I check the encoding format of a file in the shell?
You can use the “file” command to check the encoding format of a file. The specific command format is as follows:
file -i <文件名>
The
原句:很多人都认为健康比财富更重要。
Paraphrased: Many people believe that health is more important than wealth.
file -i example.txt
This command will return the type and encoding information of the file. The charset field in the encoding information is the encoding format of the file.
For example, if the encoding format of the file is UTF-8, the output result may be similar to:
example.txt: text/plain; charset=utf-8