Skip to content

Issue when creating zip file with Unicode filenames inside #84

Description

@cerisola

Hi, I am running into issues when using ZipFile.jl to create a zip archive that contains files with unicode names. Consider this minimal example:

using ZipFile

dir = ZipFile.Writer("unicode_test.zip")
f = ZipFile.addfile(dir, "α.txt"; method=ZipFile.Store)
write(f, "hi")
close(dir)

If I open the file with ZipFile.jl I can read the contents fine. However, when using other zip tools they fail to properly get the filename. For example, using the standard "unzip" command found on most linux distros (made by Info-ZIP) I get the following

> unzip unicode_test.zip
Archive:  unicode_test.zip
 extracting: +?.txt
> ls
'+'$'\246''.txt' unicode_test.zip

Of course, this is not an issue with the locale setting of the terminal, I can properly see unicode characters and zip files containing unicode filenames created with other tools work fine.

Another example where the ZipFile.jl-generated file fails is if one tries to open it with Python's official "zipfile" library:

>>> import zipfile
>>> z = zipfile.ZipFile("unicode_test.zip", 'r')
>>> print(z.namelist())
['╬▒.txt']

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions