Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Add UTF-8 flag to prevent garbled filename in contents on Windows #1432

Open
Napier-0b opened this issue Jan 5, 2020 · 3 comments
Open

Add UTF-8 flag to prevent garbled filename in contents on Windows #1432

Napier-0b opened this issue Jan 5, 2020 · 3 comments

Comments

@Napier-0b
Copy link

When you upload multiple files together uncompressed/unarchived, apparently files are archived as UTF-8 encoded Send-Archive.zip without setting Language encoding flag (EFS). cf. https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

As a result these zip files show garbled filenames in contents on Windows.

You can reproduce this problem by uploading 2 files such as "サンプル1-sample1" and "サンプル2-sample2", or whatever containing non-ASCII characters from Windows and downloading it on Windows.

Although I have not tested, maybe it can be fixed by changing
v.setUint16(6, 8, true); // bit flags (8 = use data descriptor)
to
v.setUint16(6, 2056, true); // bit flags (2056 = use data descriptor(8) + utf8-encoded(2048))
in https://github.com/mozilla/send/blob/master/app/zip.js#L32

@Natim
Copy link

Natim commented Jan 21, 2020

I have the same issue with French characters.

@Napier-JP did you figure out the unzip parameters to extract with the right filenames?

I tried:

unzip -I utf-8 Send-Archive.zip  -d out

With no luck

@Natim
Copy link

Natim commented Jan 21, 2020

I was able to do it using:

export LANG=en_US
7z x file.zip
export LANG=en_US.utf-8

@Uzume
Copy link

Uzume commented Mar 29, 2020

@Napier-JP You probably need to also update the same EFS bit in the same field in the directory entry records too since that is where the filenames actually reside. The zip archive format has a number of duplicated fields and the general purpose bit flags is just one of those.

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

No branches or pull requests

3 participants