I've been using rubyzip to manipulate OpenOffice.org files,and it works great for reading and extracting, but I've run into some issues when trying to create a zip file on Windows.
It's not that I can't create a zip file; I can, and WinZip happily opens it. But there something quirky, because OpenOffice won't read it.
The same ruby code running on Linux, though, works fine, producing a file that opens fine in OOo on both the Linux box and the windows machine.
My test scenario for this is: Take a known good sxw file. Extract the internal files; rezip using rubyzip. Try to open the new doc in OOo.
When I unzip the new doc,and compare the files with the original source files, they are identical. I can also use jar to zip up these files, and OOo is happy with the results. So it does not seem that rubyzip on windows munges the files themselves, but it might be doing something with the zip headers or structure that irks OOo.
So, before I go too crazy trying to narrow this down, I'm wondering if anyone is aware of any issues or quirks with using rubyzip on Windows.
rubyzip 0.5.0 http://sourceforge.net/projects/rubyzip
ruby version 1.8.2
Thanks,
James
James Britt wrote:
I've been using rubyzip to manipulate OpenOffice.org files,and it works great for reading and extracting, but I've run into some issues when trying to create a zip file on Windows.
It's not that I can't create a zip file; I can, and WinZip happily opens it. But there something quirky, because OpenOffice won't read it.
The same ruby code running on Linux, though, works fine, producing a file that opens fine in OOo on both the Linux box and the windows machine.
My test scenario for this is: Take a known good sxw file. Extract the internal files; rezip using rubyzip. Try to open the new doc in OOo.
When I unzip the new doc,and compare the files with the original source files, they are identical. I can also use jar to zip up these files, and OOo is happy with the results. So it does not seem that rubyzip on windows munges the files themselves, but it might be doing something with the zip headers or structure that irks OOo.
So, before I go too crazy trying to narrow this down, I'm wondering if anyone is aware of any issues or quirks with using rubyzip on Windows.
rubyzip 0.5.0 rubyzip download | SourceForge.net
ruby version 1.8.2
One more quirk: Same code, same Ruby, same PC, works fine when run from cygwin terminal rather than Windows CMD box.
James
James Britt wrote:
One more quirk: Same code, same Ruby, same PC, works fine when run from cygwin terminal rather than Windows CMD box.
Sorry, scratch that; wrong tests. Things still not good on Windows.
···
James
Sorry, scratch that; wrong tests. Things still not good on Windows.
Is it a problem with the files not being outputed in binary mode?
Rob
···
--
Personal responsibility is battling extinction.
Robert McGovern wrote:
Sorry, scratch that; wrong tests. Things still not good on Windows.
Is it a problem with the files not being outputed in binary mode?
That was my first thought, and the to-level API prevents you from explicitly opening or writing to zipfile objects in binary mode. But tit appears, from perusing the source, that the under the hood the files are opens in binary mode all the time.
I find the some malformed header issue in Linux. It appears to be an issue with how the central and local headers are calculated.
My basic test, on both win32 and Linux, was to create an OpenOffice.doc, and extract the inner files (OOo files are just a zip set of some XML files).
Rezip the same files using jar, see if OOo can open the results.
Rezip the same files using GNU zip, see if OOo can open the results.
Rezip the same files rubyzip, see if OOo can open the results.
The first two work fine on Linux and win32 (using cygwin's zip; PKZip works OK, too.)
The last fails on both Linux and win32, and testing the file with zip -T gives the message about the headers.
James