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

Add support for wide characters. #156

Closed
mykhailopylyp opened this issue Dec 16, 2020 · 11 comments
Closed

Add support for wide characters. #156

mykhailopylyp opened this issue Dec 16, 2020 · 11 comments
Labels
question Further information is requested windows related to windows OS

Comments

@mykhailopylyp
Copy link
Contributor

There are potential issues while using this lib on localized versions of windows. That can happen if a path string has characters that do to fit into char. Anyway, is there a way to deal with it now?

@kuba--
Copy link
Owner

kuba-- commented Dec 16, 2020

Look at this PR (already merged): https://github.com/kuba--/zip/pull/150/files

@kuba-- kuba-- added question Further information is requested windows related to windows OS labels Dec 16, 2020
@mykhailopylyp
Copy link
Contributor Author

The above PR does not address my concerns.
For example, if I want to pass the full path to zip_open I want to be able to pass wchar_t* instead of char* because some windows localized paths just do not fit into char*.

A possible solution - if the preprocessor directive(e.g. USE_WIDE_CHARACTERS) is defined use wchar_t* else use char* so then consumers of that code can decide what they want to use.

@kuba--
Copy link
Owner

kuba-- commented Dec 17, 2020

The above PR does not address my concerns.
For example, if I want to pass the full path to zip_open I want to be able to pass wchar_t* instead of char* because some windows localized paths just do not fit into char*.

A possible solution - if the preprocessor directive(e.g. USE_WIDE_CHARACTERS) is defined use wchar_t* else use char* so then consumers of that code can decide what they want to use.

But at the end you have to convert them for std. library, so I suppose you can use one of those helpers:
https://github.com/kuba--/zip/issues/143#issuecomment-712679521

@UAchar
Copy link

UAchar commented Jul 21, 2021

zip_extract doesn't work for UTF-8 characters. I found the problem in zip_mkpath() which calls _mkdir.
If I personally do the MB/WCHAR conversion there and and cll _wmkdir, it works.

@kuba--
Copy link
Owner

kuba-- commented Jul 21, 2021

I can fix zip_mkpath for windows in similar way how mz_stat was done.

@UAchar
Copy link

UAchar commented Jul 22, 2021

That would be very helpful! Thanks!!
Also, is there a release version coming soon?

@kuba--
Copy link
Owner

kuba-- commented Jul 22, 2021

@UAchar - PTAL https://github.com/kuba--/zip/pull/200
...if it works for you.
I can push a new release after we merge the PR(#200). I don't expect any destabilization in recent commits.

@franky920920
Copy link

Is this issue resolved in the latest release?

@kuba--
Copy link
Owner

kuba-- commented Aug 27, 2021

@franky920920 - both PRs (#200 and #150) were merged, so wide characters for fopen, mkdir, are supported since release v0.1.32.

Please, re-open the issue, if it's needed!

@kuba-- kuba-- closed this as completed Aug 27, 2021
@mykhailopylyp
Copy link
Contributor Author

@kuba--
It is still not possible to pass wchar_t* to zip_open.

@kuba--
Copy link
Owner

kuba-- commented Aug 31, 2021

@mykhailopylyp - yes, there is no public API to support wchar, but just some internal functions on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested windows related to windows OS
Projects
None yet
Development

No branches or pull requests

4 participants