You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ZipFile does not supports Unicode Path Extra Field (0x7075) zip header field #86094
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2020-10-04.11:21:41.399>labels= ['type-feature', 'library', '3.10']
title='ZipFile does not supports Unicode Path Extra Field (0x7075) zip header field'updated_at=<Date2021-01-22.01:30:26.942>user='https://bugs.python.org/ivansorokintech'
Grand unified algorithm to read filenames from zip files correctly:
Do zip entry have «Unicode Path Extra Field» (0x7075)? Use it for file name.
Is Unicode flag (0x800) set in «Flags» Field of zip entry? Assume «Filename» Field is in UTF-8.
Do «HostOS» Field of zip entry have values of 0 (FAT) or 11 (NTFS)? Assume «Filename» Field is in OEM charset corresponding to system locale.
Assume «Filename» Field is in UTF-8.
p7zip with oemcp patch (https://github.com/unxed/oemcp/) uses exactly this method, and is able to process all zip files in my test set correctly (my test set contains several zips generated by different packers on windows, macos, linux, and by online services). The same algorithm should be used in any zip unpacker wishing to process non-latin filenames as gently as possible.
Reacted by RobbWatershed
agiudiceandrea commented on Jan 22, 2021
agiudiceandreamannequin
Mannequin
More actions
I submitted more than a month ago a PR that adds support for Unicode Path Extra Field in ZipFile.
The PR #23736 is awaiting a review in order to be merged.
Activity
ivansorokintech commentedon Oct 4, 2020
See attached sample. Well-known unzip command line tool lists its contents correctly:
--------- -------
81408 1 file
But ZipFile lists the same file inside this archive as
ü' öÇæå Åä06 æòÄèäêÇ äÇäÅ (êîÆ).xls
It's because ZipFile completely ignores Unicode Path Extra Field (0x7075) zip header field.
See .ZIP specification for details on this field meaning and usage:
https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
ivansorokintech commentedon Oct 4, 2020
Grand unified algorithm to read filenames from zip files correctly:
p7zip with oemcp patch (https://github.com/unxed/oemcp/) uses exactly this method, and is able to process all zip files in my test set correctly (my test set contains several zips generated by different packers on windows, macos, linux, and by online services). The same algorithm should be used in any zip unpacker wishing to process non-latin filenames as gently as possible.
agiudiceandrea commentedon Jan 22, 2021
I submitted more than a month ago a PR that adds support for Unicode Path Extra Field in ZipFile.
The PR #23736 is awaiting a review in order to be merged.
gh-86094: Add support for Unicode Path Extra Field in ZipFile (gh-102566
pythongh-86094: Add support for Unicode Path Extra Field in ZipFile (p…
pythongh-86094: Add support for Unicode Path Extra Field in ZipFile (p…