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

Encoding support #29

Closed
ghorwin opened this issue Mar 17, 2018 · 2 comments
Closed

Encoding support #29

ghorwin opened this issue Mar 17, 2018 · 2 comments
Labels
bug windows Impact on windows archi

Comments

@ghorwin
Copy link

ghorwin commented Mar 17, 2018

Hi,

I have a problem with zip files where filenames/folder names contain "umlaute" and the zip was created in Windows using local latin9 encoding.

When unzipping on Linux utf8 encoding is expected, causing mangled filenames.

How could zip-filename-encoding be supported best in zipper?

@Lecrapouille Lecrapouille added bug windows Impact on windows archi labels Apr 11, 2019
@deeringc
Copy link

deeringc commented Oct 17, 2019

@ghorwin, I've run into the same issue and the situation is that this library doesnt handle unicode at all on Windows. Windows APIs dont support UTF8.

All of the underlying Win32 calls are to the ____A variants of the system APIs (eg. CreateFileA) rather than the ____W variants. This means that you're passing utf8 encoded strings into APIs that are expecting ASCII.

As a work around, you can use the stream based APIs.

Something like:

    std::wstring outfile = L"C:\\outdir-äöü.zip";
    std::fstream outStream(outfile, std::ios_base::binary | std::ios_base::out);
    ziplib::Zipper zipper(outStream);

    std::wstring file = L"C:\\äöü.txt";
    std::ifstream inStream(file, std::ios::binary);
    zipper.add(inStream, "file.txt"); // You can convert the name to utf8 here

    zipper.close();
    outStream.close();

@Lecrapouille
Copy link
Collaborator

To be continued on Lecrapouille/zipper#1

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

No branches or pull requests

3 participants