encoding filenames in zip archive to correct displaying in windows explorer

2.3k views Asked by At

On our site we generate zip archives on client side with jszip library. Files in this archive has nonASCII (cyrillic) characters in filenames. If use 7zip filenames displaying correctly. But some users of our site opened this zip archives with windows explorer and in this case file names displayed incorrectly.

Is there a way to encode the file names for correct display in windows explorer zip viewer?

1

There are 1 answers

1
David Duponchel On BEST ANSWER

The windows explorer up to and including Windows 7 handles poorly zip archives. The zip format specification doesn't force an encoding and the windows explorer uses the locale of the machine. It doesn't handle the unicode metadata (language encoding flag or Info-ZIP Unicode Path Extra Field): you have to use the locale of the machine which will open the file (which leads to a lot of compatibility issues).

JSZip doesn't support a custom encoding (yet) but there is an open pull request to add this feature.

An other "solution" would be to use only ASCII names (that's the conclusion of this page).

You can also stay with utf8 filenames but force your users to upgrade to at least Windows 8, apply a patch or install 7zip (that may not be the most practical solution).