Skip to main content

UnZip for non-UTF8 encoding

Extract zip files that MBCS(multi-byte character set) encoded file names, such as ZIP files created in MS Windows, especially East Asian environment.

Major non-UTF8 encodings by languages:

  • Korean: cp949, euc-kr
  • Japanese: sjis (shift_jis), cp932, euc-jp
  • Chinese: gbk, gb18030, gb2312, cp936, hkscs, big5, cp950

Install

pip install unzipmbcs

CLI Usage

usage: unzipmbcs [-h] [-e ENCODING] cmd zipfile [target [target ...]]

unzip for non-UTF8 filenames in zip archive

positional arguments:
  cmd                   commands: l(list), x(extract)
  zipfile               .zip file to unzip
  target                file prefix to extract

optional arguments:
  -h, --help            show this help message and exit
  -e ENCODING, --encoding ENCODING
                        character encoding of filename in the .zip
  -p PASSWORD, --password PASSWORD
                        password for encrypted .zip

API

listZip(filename, encoding='utf-8')

Return the information of the files in zip archive filename with character encoding

extractZip(filename, encoding='utf-8', filters=None, password=None)

Extract files in zip archive filename on current directory. Assume that the file names in zip archive are encoded as encoding. Only the files prefixed the values of filters list are extracted if filters are provided. Use password on encrypted zip archive.

fixZipFilename(filename, enc)

Fix filename as UNICODE string which is originally encoded as enc. Works for both Python 2 and 3.

Motivation

The .ZIP format, PKZIP compression, have been widely used. Some valuable data are archived as .zip file. But, in non-ASCII, non-Western environment, it makes trouble due to filenames.

Since ZIP format was created too old (1993), there is no standard character encoding about the file name of zip archive entries. Most of zip file entries are encoded as legacy character encoding, local charset.

In modern UNICODE based environment or global data processing environment such as Linux, this makes inconvenience, less portability, mangled file names, fail to extract the file, and so on.

This module may mitigate the inconveniences.

Metadata

Release files for unzipmbcs 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unzipmbcs 0.2.0
File Size Uploaded
unzipmbcs-0.2.0.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unzipmbcs 0.2.0
File Interpreter ABI Platform
unzipmbcs-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / unzipmbcs-0.2.0.tar.gz

Download URL unzipmbcs-0.2.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a5ab99716fa97aaa0ffad59178c72a2f9407fae7d487b4e4999cd9c2ef60bb4e
BLAKE2b-256 checksum
How to use checksums
d46c46d6e2c0e8631746807b59b6215473513cabc53b29d445d9f30b91849afb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / unzipmbcs-0.2.0-py3-none-any.whl

Download URL unzipmbcs-0.2.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c2397a9e6f2a5c64a5e5d0d834959abea70a819b69ffcfd492f3b45edbe6f5d
BLAKE2b-256 checksum
How to use checksums
ce603bbaec325d75c3f25e81e85f277ff33b05a8b13bc72c2b59d604fbc0f08c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page