Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-11-2012, 02:36 PM   #16
oj829
Groupie
oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.
 
Posts: 191
Karma: 574940
Join Date: Jul 2012
Device: Kobo Touch, Kobo Glo, Kobo Arc(32GB), Kobo Arc 7HD, Kobo Glo HD,NookHD
Quote:
Originally Posted by kovidgoyal View Post
If 0.9.6 did not work with that file open a bug report and attach the file, I'd be interested in taking a look at it.
It DID work in calibre 0.9.6 after 7Zip got rid of the corrupted filename in the epub.

You still want me to file?
oj829 is offline   Reply With Quote
Old 11-11-2012, 05:59 PM   #17
oj829
Groupie
oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.oj829 ought to be getting tired of karma fortunes by now.
 
Posts: 191
Karma: 574940
Join Date: Jul 2012
Device: Kobo Touch, Kobo Glo, Kobo Arc(32GB), Kobo Arc 7HD, Kobo Glo HD,NookHD
Quote:
Originally Posted by kovidgoyal View Post
If 0.9.6 did not work with that file open a bug report and attach the file, I'd be interested in taking a look at it.
Okay -- shoulda looked at the Tools first. It's been a while since the Adobe-relevant plugin to my library situation was updated in Tools, but it is now at v0.1.9 (Tools 5.4, November 6 2012) versus v 0.1.7 (Tools 5.31, September).

I just updated the plugins from Tools 5.4, restarted book download process from scratch, and the book came into Calibre just fine, including the "Chapter 36" graphic which I lost when i implemented my crude "home brewed" solution (i.e. removing the offfending "corrupt" graphic file with 7Zip).
oj829 is offline   Reply With Quote
Old 11-15-2012, 12:30 PM   #18
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,520
Karma: 5433388
Join Date: Nov 2009
Device: many
Hi Kovid,

To workaround these issues, ePubFixer uses its own zipfile.py version called zipfilerugged.py which is simply the official zipfile.py file with this one change to explicitly catch the decode problem when garbage central directory filenames are used with the encoded as utf-8 flag (and they are garbage chars, not utf-16 as far as I can tell).

Code:
    def _decodeFilename(self):
        if self.flag_bits & 0x800:
            try:
                return self.filename.decode('utf-8')
            except:
	        return self.filename
        else:
            return self.filename
This prevents zipfilerugged.py from barfing out when simply trying to open the bad zip.

Then to fix the cases where central and local filenames differ (again because of garbage chars in some central directory filenames), ePubFixer uses the following code that imports the zipfilerugged.py

(see attached zipfix.py)

Your new approach of reading the entire zip by processing the local information only should be more robust and closer to what B&N is using but ePubFixer works too.

Hope this helps.

KevinH
Attached Files
File Type: zip zipfix.py.zip (1.6 KB, 225 views)
KevinH is online now   Reply With Quote
Old 10-11-2013, 09:19 AM   #19
hd_cal_dave
Member
hd_cal_dave has a complete set of Star Wars action figures.hd_cal_dave has a complete set of Star Wars action figures.hd_cal_dave has a complete set of Star Wars action figures.hd_cal_dave has a complete set of Star Wars action figures.
 
Posts: 14
Karma: 366
Join Date: May 2012
Device: Android
Quote:
Originally Posted by kovidgoyal View Post
FYI: Using

zip -FF bad.epub --out fixed.epub

should fix the central directory issue.
Thanks a ton for this. It worked perfectly even on an encrypted DRM'd epub. I guess the encryption is on the inside of the zip file?
hd_cal_dave is offline   Reply With Quote
Old 10-11-2013, 01:54 PM   #20
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,796
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yes, epub encryption in internal, nothing to do with zip encryption.
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
'utf8' codec can't decode byte 0xd4 anthonyliu Calibre 0 10-09-2012 12:50 AM
Kindle Collections - utf8 invalid continuation byte prometheus44 Plugins 3 12-16-2011 07:22 PM
invalid library ... UnicodeDecodeError: 'utf8' codec can't ... AhShoo5n Calibre 12 08-23-2011 12:53 PM
Malformed byte sequence: Invalid byte 2 of 3-byte UTF-8 sequence. Check encoding digireads ePub 3 04-26-2011 03:07 AM
'utf8' codec can't decode bytes error (HTML to EPUB conversion) gsz Calibre 10 10-26-2009 06:29 PM


All times are GMT -4. The time now is 09:53 AM.


MobileRead.com is a privately owned, operated and funded community.