Git Product home page Git Product logo

Comments (8)

dougmassay avatar dougmassay commented on August 22, 2024

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.

johnfactotum avatar johnfactotum commented on August 22, 2024

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.

dougmassay avatar dougmassay commented on August 22, 2024

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.

johnfactotum avatar johnfactotum commented on August 22, 2024

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.

kevinhendricks avatar kevinhendricks commented on August 22, 2024

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.

kevinhendricks avatar kevinhendricks commented on August 22, 2024

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.

kevinhendricks avatar kevinhendricks commented on August 22, 2024

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.

johnfactotum avatar johnfactotum commented on August 22, 2024

It does fix the issue. Thanks!

from kindleunpack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.