"Illegal byte sequence" when using unzip on macOS High Sierra to extract a file with Cyrillic characters

See original GitHub issue

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:

MacBook-Pro-Alex:_ alex$ unzip repacked.zip 
Archive:  repacked.zip
error:  cannot create icredible_mockAPI_version/ICredible/Assets.xcassets/Images/who_rated_me.imageset/??????????????? ???+?????-?????????-3.png
        Illegal byte sequence

The original zip archive containing the same file (likely compressed with macOS “Archive Utility”)
original.zip extracts with unzip just 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?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:8
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

37reactions
mrietveldcommented, Jun 17, 2018

Use open, as in open fileWithUnicodeCharacters.zip. It looks like open will call an internal OS X program that has no problem open these type of .zip files.

17reactions
alex-swiftifycommented, Aug 2, 2018

Replacing unzip utility used in our script with ditto as suggested here fixed the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RE error: illegal byte sequence on Mac OS X
A sample command that exhibits the symptom: sed 's/./@/' <<<$'\xfc' fails, because byte 0xfc is not a valid UTF-8 char.
Read more >
unzip archive with filenames containing umlaut - Ask Different
The unzip command on a terminal fails to create such files, complaining about an illegal byte sequence. How can I fix that issue?...
Read more >
unzip cannot create non-utf8 files on APFS
I only wanted to convert the filenames during extraction, not the file content. I use iconv/recode/uconv as you suggested for the content ...
Read more >
sed gives “illegal byte sequence” error when trying to ...
I am using the “Terminal” in Mac OS X 10.10 (Yosemite) and I am trying to delete all occurrences of a from a...
Read more >
Opening the Dynalist backup files results in "Illegal byte ...
Unzip a Dynalist backup (after Dec 26 2018) file, either the txt or opml version. Expected result. The zip file should get unzipped....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found