Solution to garbled characters in zip decompression in Linux

Release: 2019-12-26 11:23:23
Original
3048 people have browsed it

Solution to garbled characters in zip decompression in Linux

The files compressed on Windows use the system default encoding Chinese to compress the files. Since the encoding is not declared in the zip file, unzip on Linux is generally decompressed with the default encoding, and the Chinese file name will be garbled.

There are 2 ways to solve the problem:

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

unzip -O CP936 xxx.zip (用GBK, GB18030也可以)
Copy after login

Interestingly, there is no such thing in the unzip manual Description of options, unzip --help has a simple description of this parameter.

2. In the environment variable, specify the unzip parameter, and always display and decompress the file /etc/environment in the specified character set. Add 2 lines UNZIP="-O CP936" ZIPINFO="- O CP936"

In this way, the archive file manager (file-roller) of the Gnome desktop can use unzip to decompress Chinese normally, but the file-roller itself cannot set the encoding and pass it to unzip.
Adopted the first method above and the problem was solved.

Recommended related articles and tutorials:linux tutorial

The above is the detailed content of Solution to garbled characters in zip decompression in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!