Linux zip file after extracting garbled solution

Source: Internet
Author: User

solution One, using Pyton to deal with

1.VI uzip File
2. Copy the content (Python)

#!/usr/bin/env python#-*-coding:utf-8-*-#uzip.py ImportOSImportSYSImportZipFilePrint "processing File"+ sys.argv[1] File=zipfile. ZipFile (Sys.argv[1],"R"); forNameinchfile.namelist (): Utf8name=name.decode ('GBK')    Print "extracting"+Utf8name Pathname=os.path.dirname (utf8name)if  notOs.path.exists (Pathname) andpathname!="": Os.makedirs (pathname) Data=file.read (name)if  notos.path.exists (utf8name): Fo= Open (Utf8name,"W") fo.write (data) fo.closefile.close ()

3.chmod +x Uzip
4../uzip Xxxx.zip

Method 2, extract by Unzip line command, specify character set (recommended)

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

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

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

Add 2 rows to the/etc/environment

unzip= "-O Cp936″
zipinfo= "-O Cp936″

Method 4, unpack the zip package jar using the Java Jar command

Jar XVF File.name

Linux zip file after extracting garbled solution

Related Article

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.