zip-rs / zip2

Zip implementation in Rust
Other
104 stars 34 forks source link

Can't extract chinese filename when diff os #159

Closed xiao-e-yun closed 4 months ago

xiao-e-yun commented 4 months ago

Describe the bug When adding a Chinese filename to an archive on Windows, the true filename cannot be extracted on Linux.

To Reproduce Steps to reproduce the behavior:

  1. Create 你好.txt (space file).
  2. Add to hello.zip move file to linux.
  3. Run extract example cargo run --release --example extract -- hello.zip.
  4. Extract will be File 0 extracted to "ºAªn.txt" (0 bytes).

Expected behavior Extract will be 你好.txt

Screenshots image

Desktop

Server

Pr0methean commented 4 months ago

Could you please upload the file hello.zip that you experienced this with? I don't have easy access to a Windows PC. I'm working on a possible fix, but need an example to test it on. It's possible that this is a bug in 7zip rather than in this crate.

xiao-e-yun commented 4 months ago

Only empty file 你好.txt windows-builtin.zip windows-7zip.zip linux-7z.zip

Pr0methean commented 4 months ago

For windows-builtin.zip, this is a bug in Windows - it writes the filename as UTF-8 but doesn't set the Language Encoding flag. When clear, that flag incorrectly identifies the filename encoding as CP437.

For both 7zip files, this will be fixed in v2.1.3.