Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does linux view the file encoding format

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "linux how to view the file encoding format", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "linux how to view the file encoding format" bar!

View method: 1, use the file command to view, syntax "file filename"; 2, use the enca command to view, syntax "enca filename"; 3, open the file in Vim, switch to the bottom line command mode, enter ": set fileencoding" on the bottom line to view.

The operating environment of this tutorial: CentOS 6 system, Dell G3 computer.

The operating environment of this tutorial: CentOS 6 system, Dell G3 computer.

The method of viewing codes under linux

Method 1: file view

File filename

Method 2: enca view

Prerequisite: enca is installed

Enca filename

Method 3: you can view the file encoding directly in Vim

Vim opens the file, switches to the bottom line command mode, and enters the following command on the bottom line:

: set fileencoding

The file encoding format can be displayed.

If you just want to view files in other encoding formats or want to solve the problem of garbled viewing files with Vim, you can use the

Add the following to the ~ / .vimrc file

Set encoding=utf-8fileencodings=ucs-bom,utf-8,cp936

In this way, you can let vim automatically identify file encodings (you can automatically identify UTF-8 or GBK encoded files), which is actually an attempt according to the coding list provided by fileencodings. If you do not find a suitable encoding, open it with latin-1 (ASCII) coding.

Thank you for your reading, the above is the content of "linux how to view the file encoding format", after the study of this article, I believe you have a deeper understanding of how to view the file encoding format of linux, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report