Skip to content

why I can't use it with chinese file name #226

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

Open
kooksee opened this issue Aug 5, 2015 · 1 comment
Open

why I can't use it with chinese file name #226

kooksee opened this issue Aug 5, 2015 · 1 comment
Labels

Comments

@kooksee
Copy link

kooksee commented Aug 5, 2015

I want to zip kinds of files,but I try many times I just can't zip chinese name file,such as
zip.file('顶顶顶顶', fs.readFileSync(path)); .Can you help me ? Thank you very much!

@kooksee kooksee changed the title why I can use it with chinese file name why I can't use it with chinese file name Aug 5, 2015
@dduponchel
Copy link
Contributor

What do you use to check the result ? Windows 7's explorer ?

JSZip uses UTF8 to encode/decode the file name inside a zip file (see also #211 for other encodings).
Unfortunately, the compressed folders feature on Windows (up to and including Windows 7) uses the locale of the machine which will open the file (even with an unicode flag). Other file archivers that handle UTF8 will be fine (I just tested your example on my machine).
If you use #211 to use a different encoding for the file name, you might have issues with other tools like 7zip which only understand UTF8.
This issue is not specific to JSZip, others have this issue too (1, 2, 3).

We need to add this in the documentation, this question is asked regularly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants