In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the Linux file coding how to convert the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this Linux file coding how to convert the article will have a harvest, let's take a look.
This is because the default file format in Windows is GBK (gb2312), while Linux is generally UTF-8. So how to look at the encoding of the file in Linux and how to transcode the file?
1. Use VIM to view the file encoding
You can view file encodings directly in Vim
: set fileencoding
The file encoding format can be displayed.
2. Rewrite ~ / .vimrc file
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-8 fileencodings=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.
3. Transcoding with ICONV files
We use the iconv tool to convert the encoding of the file.
Iconv conversion. The command format of iconv is as follows:
Iconv-f encoding-t encoding inputfile
For example, convert a GBK-encoded file to UTF-8-encoded file
Iconv-f GBK-t UTF-8 file1-o file2
The meaning representation of the parameters in it
-f From some code
-t To some code
-o Export to file
4. Change the file encoding by saving notepad as
Open it with notepad under Windows and choose Save as. Just change the code.
This is the end of the article on "how to convert File Encoding under Linux". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to convert document coding under Linux". If you want to learn more knowledge, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.