Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The file name is incorrectly encoded after the file is decompressed #14

Closed
lopo12123 opened this issue Jul 18, 2023 · 4 comments · Fixed by #32
Closed

The file name is incorrectly encoded after the file is decompressed #14

lopo12123 opened this issue Jul 18, 2023 · 4 comments · Fixed by #32
Labels
bug Something isn't working

Comments

@lopo12123
Copy link

My code is as follows, when I unzip my zip file, the Chinese file name inside it is wrongly encoded

use std::io::Cursor;
use std::path::{Path, PathBuf};

pub fn extract_zip(zip_buffer: Vec<u8>, dest: &Path) -> Result<(), String> {
    match zip_extract::extract(
        Cursor::new(zip_buffer),
        dest,
        false,
    ) {
        Ok(_) => Ok(()),
        Err(err) => Err(format!("{}", err))
    }
}

below is what the code unzips and how it should actually look like
image
image

@MCOfficer
Copy link
Owner

Given that this crate just uses the names as provided by zip-rs, i'm tempted to blame it on upstream. But then again, this is using zip-rs 0.6.4, which is very outdated. Will require further testing, not sure when i'll get to it.

@MCOfficer MCOfficer added the bug Something isn't working label Jul 18, 2023
@RecordingTheSmile
Copy link

RecordingTheSmile commented Jun 12, 2024

Actually, if you clone this repo and change zip version to 2.1.3, you can solve this problem without any modification to code.

This problem should be related to zip-rs/zip2#159

@MCOfficer
Copy link
Owner

thanks for finding that, i've been meaning to update to zip2 eventually.

@MCOfficer
Copy link
Owner

Big thanks to @DaniPopes for updating zip-extract to v0.2, which uses zip2!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants