|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#16 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 112
Karma: 510888
Join Date: Jul 2012
Device: Kobo Touch, Kobo Glo, Kobo Arc(32GB)
|
|
|
|
|
|
|
#17 | |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 112
Karma: 510888
Join Date: Jul 2012
Device: Kobo Touch, Kobo Glo, Kobo Arc(32GB)
|
Quote:
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). |
|
|
|
|
|
Enthusiast
|
|
|
|
#18 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 597
Karma: 230878
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
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 |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
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 |