-
Notifications
You must be signed in to change notification settings - Fork 1k
ZipFile: Bugfix: Use unicode encoding to read the name string if UseUnicode is set #284
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
…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.
|
UTF8_Filenames.zip |
|
This will probably be corrected by #280. Can you confirm this? |
|
Hi, #280 DOES NOT solve the issue. |
|
Please reopen. |
|
What is the issue that you are trying to fix? The property is read from the headers, manually overriding them by setting the property here does nothing as far as I can tell. |
|
I have attached a sample file, when reading the filenames they are not read as Unicode. I have tested the fix and it does solve the issue. |
|
No, its not set because thats not what it is for. ZipStrings uses Unicode if the Zip file header has the Unicode flag set. If the header is not used when decoding the file names, then there is another bug somewhere, but the UseUnicode property is not for the library to use internally, it's meant to be use for manually overriding the Encoding or specifying it for creating new archives. |
|
I'm not sure what the right solution is, I have attached the sample to demonstrate that there is a problem somewhere. please reopen. |
|
Could you provide the code you are using? You should start by making an issue. Ideally with a short code sample that reproduces the issue. The testing code does not currently experience your problem afaik. I closed this because it is a PR that does not seem to fix an issue and introduces bugs. |
|
Are you saying that UseUnicode is for encoding only, and that there is no comparable flag to force Unicode decoding? |
|
That is what #280 adds. The ability to override the flag for decoding. |
|
I do I turn it on? |
|
I will write some code samples when 1.1 is released. Ill try to get it released this weekend, it's long due. Unfortunatly I've been rather busy as of late. |
|
OK, I can confirm that when using #280 and setting ZipStrings.CodePage = 65001 the file names are decoded correctly. Thanks for all your efforts! much appreciated! |
|
UseUnicode should definitely change the encoding used for extracting. I probably overlooked it when merging 280. Ill take a look. |
|
I think you meant to write 'UseUnicode should definitely change the decoding' |
|
I have observed that when setting ZipStrings.CodePage = 65001 the filenames are decoded correctly but |
|
In your example you are not setting the codepage? |
|
65001 is the default so it doesn't matter if I set it or not. (I checked) |
This is to amend PR #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.
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.