PclZip vs. DotNetZip

Jul 13, 2009 at 5:06 PM

Hi there. Firstly thank you for your great job with DotNetZip. Wonderfull work :) My problem is that I create a zip from php using PclZip, and DotNetZip can't extract it, saying a "Bad signature" error. Could you tell me what is the error and how can I fix? Thanks in advance.

Coordinator
Jul 13, 2009 at 5:31 PM

Hey, thanks for using the forums.  The whole goal is to make the knowledge base searchable. I don't know PclZip, and I'm not sure how many people use it, but maybe someone else might have the same problem, so let's use the forums just in case.

I looked at the ZIP at the link you gave me and found a BOM at the start of the file.  Following the BOM is the data for a valid zip file. 

If I remove the BOM, the file unzips just fine. 

Therefore,  the way you are constructing your file seems to be incorrect.  According to my understanding there should be no BOM at the start of a binary file, like a ZIP file.

 

Jul 13, 2009 at 5:50 PM

Thanks for the answer. Could you tell me what exactly BOM stands for?

Coordinator
Jul 13, 2009 at 10:08 PM
Edited Jul 14, 2009 at 12:10 PM

Oh, sorry.   Jargon.

BOM = Byte Order Mark .    A series of header bytes sometimes attached to unicode-encoded text files.  Shouldn't be present on a binary file.  http://en.wikipedia.org/wiki/Byte_Order_Mark

For UTF-8, the BOM is EF BB BF which is what I found at the start of your zip file.

I saw your 2nd mail which said, you discovered the same thing. Somehow your output routine is going through a text processing stream, which emitting that BOM. For a text file, it would be ok. For a zip file, not.

Jul 14, 2009 at 6:59 AM

OK, thanks, at least now I'm calm, that removing the first 3 bytes from the zip won't cause any problems.

Coordinator
Jul 14, 2009 at 12:18 PM

On the contrary, removing those first three bytes makes the file usable.  Removing the rubbish does not cause problems, it solves problems.  The file is not usable otherwise.