Git Product home page Git Product logo

Comments (6)

dillof avatar dillof commented on May 20, 2024

On wich operating system are you using libzip?

Can you trace through zip_open to see where the error occurs?

from libzip.

ZockerFloh7 avatar ZockerFloh7 commented on May 20, 2024

Hey, thanks for your fast reply.
I am using Windows 7 Professional x64 with libzip 1.5.1.

This is the path that gets passed to the function:

C:\exchange\OfflineDatensätze\bP Rapid\NOK\EthSpy Fehler\D0001Z001\offlineDataset.zip;

The error happens in zip_source_win32utf8.c (line 62):
/* Convert fname from UTF-8 to Windows-friendly UTF-16. */ size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fname, -1, NULL, 0); if (size == 0) { zip_error_set(error, ZIP_ER_INVAL, 0); return NULL; }

Seems like the function MultiByteToWideChar returns zero, but I can´t imagine why.

from libzip.

dillof avatar dillof commented on May 20, 2024

Maybe the file name is not encoded in UTF-8, but some other encoding like ISO-8859-1. If so, you will have to convert it to UTF-8 before passing it to libzip.

from libzip.

ZockerFloh7 avatar ZockerFloh7 commented on May 20, 2024

Okay, I have not much experience with encodings, here is the part of the code, where I try to open the archive:

c_archive = zip_open(c_fileName.c_str(), ZIP_RDONLY, &error);

c_fileName is just a std::string, I get it from a file choosing dialog.
Can this be the problem?
Can you tell me how to convert it to utf8?

from libzip.

dillof avatar dillof commented on May 20, 2024

Sorry, I'm not a Windows developer. Examine c_fileName to see wether it is in UTF-8.

from libzip.

ZockerFloh7 avatar ZockerFloh7 commented on May 20, 2024

It seems like c_fileName is Latin(ISO-8859-1) encoded.
I converted it to UTF8 now, and its working with umlauts.
Thank you for your great support!

from libzip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.