jupyter-archive
jupyter-archive copied to clipboard
Filename decoding issue for zip files archived by macOS
Description
just the same as https://github.com/weichsel/ZIPFoundation/issues/63 python zipfile lib using flag to determind the encoding of the file https://github.com/python/cpython/blob/main/Lib/zipfile.py#L1384 but osx compress won't set that so we may need to guess the encoding for zip
Reproduce
- Go to '...'
- Click on '...'
- Scroll down to '...'
- See error '...'
Expected behavior
Context
- Python package version:
- Extension version:
- Operating System and its version:
- Browser and its version:
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Web Browser Output
Paste the output from your browser web console here.
I will provide a broken zip later and here is how I solve this problem https://github.com/jupyterlab-contrib/jupyter-archive/pull/75/files feel free to improve it thanks
I have provided a less elegant solution in my branch with two main problems
- using
try ... encodeto probe the encoding, efficiency and accuracy are not guaranteed - need to decompress to a temporary folder before decoding and moving, which further reduces efficiency; if using
readfor writing, we have to determine whether the path represents a file or a folder
thanks for trying providing a solution and reported back.
This is actually a cross-platform issue, caused by the default zip implementation of mac and windows not matching the protocol.
We provide a new implementation, but in fact the encoding incompatibility problem of windows is related to the language used by the user, currently it is only compatible with gbk(Chinese)
https://github.com/jupyterlab-contrib/jupyter-archive/pull/108