mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
"Illegal byte sequence" when using unzip on macOS High Sierra to extract a file with Cyrillic characters #250
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alex-swiftify on GitHub (Oct 24, 2017).
When trying to extract repacked.zip (created with SharpCompress)
with macOS
unzip(UnZip 6.00 of 20 April 2009, by Info-ZIP), the file with cyrillic characters in its name (Векторный смарт-объект-3.png) fails to extract:The original zip archive containing the same file (likely compressed with macOS "Archive Utility")
original.zip extracts with
unzipjust fine.This problem appeared since I have upgraded to macOS High Sierra (= was not present on macOS Sierra).
Is there anything we can do with the file encoding (i.e. use Unicode) to have it properly unzipped by macOS
unzip?@adamhathcock commented on GitHub (Oct 25, 2017):
There is the ArchiveEncoding that is defaulting to UTF8. I should revisit the spec to see about flagging more encoding if that's possible.
It's likely all of zip encoding needs to be revisited. It is odd though that it's only broken with High Sierra. I guess
unzipgot more strict.@alex-swiftify commented on GitHub (Oct 25, 2017):
Thanks! Can we currently set the encoding to anything else (i.e. UTF16) without changes to SharpCompress?
Since the "unzip" utility is dated 20 April 2009, I'm pretty sure this is related to upgrade to APFS file system that was introduced in High Sierra.
@adamhathcock commented on GitHub (Oct 25, 2017):
Yeah you can change the encoding to anything. It's just if unzip understands/expects it or not. The code is only writing out a specific flag for UTF8
@HadrainChen commented on GitHub (May 29, 2018):
Has anyone fix?
@mrietveld commented on GitHub (Jun 17, 2018):
Use
open, as inopen fileWithUnicodeCharacters.zip. It looks likeopenwill call an internal OS X program that has no problem open these type of.zipfiles.@alex-swiftify commented on GitHub (Aug 2, 2018):
Replacing
unziputility used in our script withdittoas suggested here fixed the problem.@Jack-ym commented on GitHub (Apr 26, 2019):
I have met the same question,have you had the correct solution?
@LeSaul commented on GitHub (Feb 17, 2020):
I had the same issue and tried to unzip and open the file through terminal but the quick solution was ask to a workmate that use windows help to expand the file. Maybe the file folder is too long or idk why it's happening. Cross-platform issues?
@tatoalo commented on GitHub (Mar 12, 2020):
Just happened to me today.
@LeSaul, instead of relying on a workmate you could maybe use this, worked like a charm.
@dbogatov commented on GitHub (Jun 24, 2024):
Install latest unzip from brew
brew install unzip.