Solution of Chinese name garbled after unzip decompression in Linux system

Source: Internet
Author: User
Tags character set zip

Solution One, use Pyton to deal with

1.VI uzip File

2. Copy content (Python)

#!/usr/bin/env python

#-*-Coding:utf-8-*-

# uzip.py

Import OS

Import Sys

Import ZipFile

Print "Processing File" + sys.argv[1]

File=zipfile. ZipFile (Sys.argv[1], "R");

For name in File.namelist ():

Utf8name=name.decode (' GBK ')

Print "Extracting" + utf8name

pathname = Os.path.dirname (utf8name)

If not os.path.exists (pathname) and pathname!= "":

Os.makedirs (Pathname)

data = File.read (name)

If not os.path.exists (utf8name):

fo = open (Utf8name, "w")

Fo.write (data)

Fo.close

File.close ()

3.chmod +x Uzip

4../uzip Xxxx.zip

Method 2, using the Unzip line command to extract the specified character set

Unzip-o CP936 Xxx.zip (with GBK, GB18030 can also)

Interestingly, there is no description of this option in Unzip's manual, and Unzip–help has a simple line for this parameter.

Method 3, in the environment variable, specify the unzip parameter, always display the decompression file in the specified character set

Add 2 lines to the/etc/environment

unzip= "-O Cp936″

zipinfo= "-O Cp936″

Method 4, using Java Jar command to extract the ZIP package jar Decompression

Jar XVF File.name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.