Comments (12)
I did notice that, but it hasn't been a problem for me.
Could zip files have their file names in another character set?
Perhaps it would be better to make the filename encoding a property that the user can set. That way, if they know the file is coming from windows, they can use NSWindowsCP1252StringEncoding for example.
Thoughts?
from ziparchive.
User configurable encoding would work for me. In my application I do not know what files the users will be working with, thought so I would just set it to UTF8. Wouldn't UTF8 be a good default? I am not expert on this, but it should be backwards compatible with ASCII and therefore if a filename really is ASCII, decoding it with UTF8 produces the correct result.
Here is a test case
https://dl.dropboxusercontent.com/u/694399/5XVQU5E3.zip
The file opens on my Mac, but the filename is garbage.
Mikkos-MacBook-Pro:Downloads mronkko$ unzip -l 5XVQU5E3.zip
Archive: 5XVQU5E3.zip
Length Date Time Name
-------- ---- ---- ----
2866661 08-06-13 14:24 �и�е� Ю, �ан��л� �а�дона - ��нов� �изики пол�п�оводников - 2002 [05].pdf
-------- -------
2866661 1 file
This does not open with the current version of ZipArchive, but it opens with the same garbage filename when I change the encoding to NSUTF8StringEncoding
from ziparchive.
What an interesting filename. I don't know what encoding that is in. I think it's lucky that UTF-8 accepted it.
UTF-8 has some rules about what is valid. You can't expect to throw random bytes at it and expect it to mean something.
Would you happen to know what language that file is in, and then guess the correct encoding?
Certainly looks like a configurable option is the way to go. Perhaps you could guess the encoding based on the user's locale settings or something.
from ziparchive.
The filename is in Russian and cyrilic characters. It may work with NSWindowsCP1251StringEncoding, but I have not tested it.
User configurable encoding is a good idea because it would allow fallback options or even presenting the user an UI to choose the correct encoding if it cannot be determined otherwise.
from ziparchive.
Added property in 11c879a
Can you please verify this works for you?
from ziparchive.
Works just fine.
I will include this in the test version of my app and let you know if any of my testers encounter any problems.
On Aug 7, 2013, at 15:07 , Matt Connolly <[email protected]mailto:[email protected]>
wrote:
Added property in 11c879ahttps://github.com/mattconnolly/ZipArchive/commit/11c879a8b7b6c57f1ae45d2aa7fd98d44149b02e
Can you please verify this works for you?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-22246354.
from ziparchive.
Released updated cocoapod, version 1.2.0 including this update.
from ziparchive.
This change or some other change has caused some problems for some of my testers and I have myself confirmed cases where after encoding filenames with UTF8, the zipfile can no longer be opened either with ZipArchive on iOS or on my Mac.
I am still investigating the exact cause.
from ziparchive.
Can you please clarify: If you set the stringEncoding to ascii it works, right? Like so:
ZipArchive* zip;
zip.stringEncoding = NSASCIIStringEncoding;
from ziparchive.
I need to do some more tests, and will post the results.
from ziparchive.
I created an empty project and setup ZipArchive with CocoaPods and this setup works just fine with UTF8, so the corrupted zip files are caused by something else.
from ziparchive.
I have done some testing and it seems that I cannot create valid zip archives with any version of ZipArchive installed with cocoapods. Unzipping existing archives works just fine.
I set up a a very simple iOS app that compresses a PDF file in the AppDelegate and then uncompresses the same file. The uncompressing part fails and when I run this in the simulator, I can uncompress the archive, but the file inside is corrupted.
https://dl.dropboxusercontent.com/u/694399/ZA.zip
from ziparchive.
Related Issues (20)
- getZipFileContents does not produce the same filenames as UnzipFileTo:overWrite: HOT 1
- Making iOS binary errors
- Z_DATA_ERROR in arm64bit during inflate HOT 1
- UnzipFileToMemory doesn't return files with zero length
- many value stored to success or err never used
- "direct.h" file not found HOT 4
- chinese friends,look here
- "direct.h" file not found
- UnzipOpenFile fails on empty zips
- Swift support HOT 2
- minizip.c
- minizip.c HOT 2
- Retain Cycle cause by strong reference to delegate HOT 2
- i got problem to use libxlsxwriter and ZipArchive together HOT 1
- Can't extract under iPhone7.
- Swift Package Manager support
- Does it support AES128 192 256 encrypt and How can I enable AES encrypt?
- Adding files to archive with newname is Case Insensitive
- Down
- Direct.h not found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ziparchive.