zip icon indicating copy to clipboard operation
zip copied to clipboard

When writing file names in Cyrillic, the file is not written

Open HellsCoder opened this issue 3 years ago • 2 comments

Hello! I trying to write file to zip with cyrillic symbols

			zip_entry_open(zip, "тест.txt");
			zip_entry_write(zip, content, size);
			zip_entry_close(zip);

Archive is empty..

HellsCoder avatar Jun 17 '22 21:06 HellsCoder

We've already discussed utf-8 topic in many threads. Please take a look: https://github.com/kuba--/zip/search?q=utf-8&type=issues

kuba-- avatar Jun 19 '22 11:06 kuba--

This library is based on https://github.com/richgel999/miniz and we want to keep it compatible is much as possible. UTF-8 for entry names (and comments) is supported by ZIP spec. if 11 BIT is set in general purpose bit flag. (https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) Unfortunately miniz checks only encryption bits for general purpose bit flag.

So, first we need to add support to miniz. After that, update dependency for this library.

kuba-- avatar Jul 07 '22 20:07 kuba--

We support this issue with 40tb archive of Open Source Buddhism Library. Most part of our archive materials is on asian languages and humanly no possible rename all this materials.

Please accept heart gratitude from all our library team for your and Miniz team generous contribution to open source community for benefit of all mankind.

Open Source Buddhism Library Alexander Stroganov

RimeOCRLIB avatar Oct 21 '23 11:10 RimeOCRLIB

Guys @HellsCoder, @RimeOCRLIB - I've sent a PR (https://github.com/kuba--/zip/pull/323) with migration to miniz v.3.0.2. So on the branch https://github.com/kuba--/zip/tree/miniz-3.0.2 you can find a new code with upgraded miniz lib. With that said, you can try to use UTF-8 like in the test which I've recently added: https://github.com/kuba--/zip/blob/miniz-3.0.2/test/test_write.c#L44

If you use this library to compress/decompress or tools like macos finder, etc. it should work fine. But keep in mind it's just a proposal, so some tools may not work.

kuba-- avatar Nov 28 '23 18:11 kuba--

This library is based on https://github.com/richgel999/miniz and we want to keep it compatible is much as possible. UTF-8 for entry names (and comments) is supported by ZIP spec. if 11 BIT is set in general purpose bit flag. (https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) Unfortunately miniz checks only encryption bits for general purpose bit flag.

So, first we need to add support to miniz. After that, update dependency for this library.

With new miniz (v3.0.2) it should be fixed, because an extra bit flag (MZ_ZIP_GENERAL_PURPOSE_BIT_FLAG_UTF8) was added.

kuba-- avatar Dec 01 '23 10:12 kuba--

I'm closing the issue, because after merge miniz-3.0.2 it should be fixed. Otherwise, do not hesitate to reopen it.

kuba-- avatar Dec 02 '23 13:12 kuba--