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

Correctly handle Unicode strings #255

Merged
merged 9 commits into from
Jul 21, 2018
Merged

Conversation

piksel
Copy link
Member

@piksel piksel commented Jul 20, 2018

Commit 2c458be replaced the default code page with UTF-8, but ZipEntry.IsUnicodeText is still set to false by default.
This makes it the default behaviour of SharpZipLib to create zip files that claim they are not coded using UTF-8 (but instead with what is presumed to be the locale default code page), but still containing UTF-8 encoded file names.

This PR will rectify that by setting the ZipEntry.IsUnicodeText default based on what ZipStrings.CodePage (previously called ZipConstants.DefaultCodePage) is set to.

This also moves the string transcoding from ZipConstants to ZipStrings as I could not let it stay inside a class obviously named for another purpose.
There are still wrappers for all public functionality that provides full backwards compability.

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

@piksel piksel self-assigned this Jul 20, 2018
@piksel piksel added zip Related to ZIP file format in progress labels Jul 20, 2018
@piksel piksel added ready PR ready for merging when appropriate and removed in progress labels Jul 21, 2018
@piksel piksel merged commit fb9efd0 into icsharpcode:master Jul 21, 2018
TalAloni added a commit to TalAloni/SharpZipLib that referenced this pull request Oct 27, 2018
…nicode is set

This is to amend PR icsharpcode#255, note that before this patch the UnicodeText flag is set in the ZipEntry constructor, after we have already read the name as non-unicode, which is obviously not right.
@piksel piksel deleted the zipstrings branch October 29, 2018 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PR ready for merging when appropriate zip Related to ZIP file format
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant