Comments (8)
Hard to believe something like that has never been encountered before. Are you sure that's the underlying reason for the failure?
Epub2 or Epub3
from kindleunpack.
Yes, the NCX file works after manually changing &
to &
. Otherwise the book still works fine. Just that the table of contents will be empty.
I discovered this while looking at the EPUB file in johnfactotum/foliate#819. The file looks like it was generated by a version of KindleUnpack (it has a BEGIN INFORMATION ONLY
section which contains metas with the exact same names as those in KindleUnpack, as well as an unreachable coverpage with the inserted
idref). The NCX file in it has an &
in the text
in docTitle
.
So I went on a found a MOBI file with &
in the title, unpacked it with KindleUnpack, and it has the same problem. The &
in the title is not escaped.
from kindleunpack.
Any KF8 Kindlebook that has an unescaped ampersand in the title metadata is broken. Broken Kindlebook can break kindleunpack. We try to make sure that broken mobis don't crash KindleUnpack, but it's pretty hard for us to accommodate every possible scenario that a bad Kindlebook might present to KindleUnpack. None of the standard Kindlebook creation tools that I know of would create title metadata with an unescaped ampersand.
We'll look into it further, but I don't like to travel too far down the rabbit-hole of trying to accommodate "wildcat" Kindlebooks.
from kindleunpack.
Just checked. In this particular book, the updated title (503) in EXTH doesn't contain an ampersand. However, it does have one in the title in MOBI header (the one you get from 0x54 and 0x58). And the latter title is the one used by KindleUnpack.
Also, the ampersand is escaped in the OPF. Just not in the NCX.
from kindleunpack.
Yes, we use the exact same Metadata 'Title' value in the opf and ncx generation routines but in the opf we run escapeit(unescapeit(val)) to first undo any xml escaping and then xmlescape it.
We do not do that for the ncx generation code.
I will look into making things more robust for ncx generation.
from kindleunpack.
In line 170 and line 261 in mobi_ncx.py we need to replace title in the parameter list with xmlescape(escapeit(title)).
I will make this change when I get access to my dev machine tonight.
from kindleunpack.
Just pushed this change to master. Please confirm this fixes your issue so I can then close this.
Thank you for your bug report.
from kindleunpack.
It does fix the issue. Thanks!
from kindleunpack.
Related Issues (20)
- unpack awz4 is grayed out HOT 2
- UnicodeEncodeError HOT 4
- Crash unpacking calibre-generated 'both' MOBI files HOT 29
- Unable to unpack azw file with .opf content HOT 5
- Unpacked files size doubled HOT 7
- Script throws AttributeError when parsing NCX navList HOT 5
- except error: Processing ncx / toc HOT 7
- Fix simple typo: specifc -> specific
- Re-packing to .mobi HOT 1
- Have considered package kindle ebooks parser into a pip package? HOT 5
- Incorrect language codes HOT 5
- Some Inflection data lost in the html file produced from kindle dictionary by KindleUnpack HOT 1
- KindleUnpack_ReadMe.htm references incorrect Python version HOT 2
- Incorrect version displayed on screen in DumpMobiHeader_v023.py HOT 1
- Convert `original-resolution` to `rendition:viewport` HOT 20
- encoding issue with source code under Microsoft Windows and default codepage HOT 1
- AttributeError: 'array.array' object has no attribute 'tostring' proposed fix HOT 4
- imghdr used in cover will be removed in python 3.13 HOT 4
- Named character references are not allowed in ePub HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kindleunpack.