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, 03: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: 180
Karma: 574940
Join Date: Jul 2012
Device: Kobo Touch, Kobo Glo, Kobo Arc(32GB), 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, 06: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: 180
Karma: 574940
Join Date: Jul 2012
Device: Kobo Touch, Kobo Glo, Kobo Arc(32GB), 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, 01:30 PM   #18
KevinH
Wizard
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: 1,020
Karma: 444444
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, 93 views)
KevinH is offline   Reply With Quote
Old 10-11-2013, 10: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, 02: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: 26,338
Karma: 5382313
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 01:50 AM
Kindle Collections - utf8 invalid continuation byte prometheus44 Plugins 3 12-16-2011 08:22 PM
invalid library ... UnicodeDecodeError: 'utf8' codec can't ... AhShoo5n Calibre 12 08-23-2011 01:53 PM
Malformed byte sequence: Invalid byte 2 of 3-byte UTF-8 sequence. Check encoding digireads ePub 3 04-26-2011 04:07 AM
'utf8' codec can't decode bytes error (HTML to EPUB conversion) gsz Calibre 10 10-26-2009 07:29 PM


All times are GMT -4. The time now is 03:48 PM.


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