-
Notifications
You must be signed in to change notification settings - Fork 1k
Allow overriding encoding for zip ectraction #280
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
Conversation
Some samples become broken when they're writen to byte array with their encoder
|
This solution is more or less what I had intended too. The only problem with this approach is that you cannot force UTF-8 encoding by setting the Charset. The SystemDefaultCodePage ( |
No, forcing UTF-8 is still possible. If UTF-8 flag is set in archive - then UTF-8 will be used regardless of codepage property. Please, can you clear the problem you've mentioned? What utf-8 forcing do you want? |
|
With this solution you would not be able to unzip an archive that uses UTF-8 as it's encoding, whilst the unicode bit is not set. It would work if your systems default encoding is UTF-8, but not otherwise. Perhaps having |
Why? If client sets CodePage to 65001 then UTF-8 will be used and archive will be read correctly. Am I wrong? |
|
If CodePage is set to 65001 then CodePage == Encoding.UTF8.CodePage? SystemDefaultCodePage : CodePagewill result in |
|
Yes, this is wrong. I'll fix it to -1 as you proposed before |
|
@piksel please review this. |
|
@piksel thanks a lot! When the new NuGet version is planned? I want to use this fix in my project as soon as possible. |
|
I'll try to get it done this weekend. |
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.
Issues #274 and #278 are fixed, but there's an another issue with Unicode test samples.
It seems, that Greek and Arabic samples are incorrect. I've added a workaround in EvilBeaver@887e10d
Probably, old-code tests weren't failing, because ZipStrings.SystemDefaultCodePage was set to 65001, which is seems to be returned by default from Encoding.GetEncoding(0) on net.core