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 to solve the problem of decompressing garbled zip files under linux in CVM

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces how to solve the problem of decompressing garbled zip files under linux in CVM. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

CVM: solves the problem of decompressing garbled zip files under linux

Because the zip format does not specify the encoding format, the encoding in the zip files generated under Windows is GBK/GB2312 and so on, which leads to garbled problems when these zip files are decompressed under Linux, because the default encoding under Linux is UTF8.

Solution one

Use 7z to decompress.

Install p7zip and convmv

# fedora $su-c 'yum install p7zip convmv' # ubuntu $sudo apt-get install p7zip convmv

Execute the command to unzip

# decompress $7za x your-zip-file.zip # Recursive transcode $convmv-f GBK-t utf8-- notest-r.

Solution two

Files compressed on windows are compressed in Chinese by default. Because its encoding is not declared in the zip file, the unzip on linux is generally decompressed with the default encoding, and the Chinese file name will be garbled.

Although some people reported this as bug in 2005, info-zip 's official website did not include automatic identification codes in the plan, and they may not think this is a problem. Sun adopts the same way to deal with the N-year zip coding problem in java.

There are two ways to solve the problem:

1. Extract and specify the character set through the unzip line command

Unzip-O CP936 xxx.zip (GBK, GB18030 is also possible)

Interestingly, there is no description of this option in unzip's manual, and unzip-help has a simple description of this parameter.

two。 In the environment variable, specify the unzip parameter, always display and extract the file in the specified character set

Add 2 lines to / etc/environment

UNZIP= "- O CP936" ZIPINFO= "- O CP936"

In this way, the Archive Manager (file-roller) of the Gnome desktop can normally use unzip to extract Chinese, but file-roller itself cannot set the encoding to be passed to unzip.

This is the end of how to solve the problem of decompressing garbled zip files under linux in the CVM. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

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