View Single Post
Old 03-20-2021, 01:48 PM   #13
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: 8,893
Karma: 6120478
Join Date: Nov 2009
Device: many
I simply can not believe calibre's quality check approves of using an "&" in a file name inside an epub!

Even so urls/uris are supposed to be % encoded not xml escaped. So unless Kovid can point to the epub spec where "&" chars are supposed to xml escaped in urls or uri's in the opf, I consider this a bug in calibre not Sigil.

An & is not a legal char in a uri/url filename or path and you can not xml escape an & without using another &!

percent encoding of spaces, &, #, etc is how the spec says to deal with these chars.

That said, I could try to xml unquote the filename before % decoding but I think that will probably open a kettle of fish for something that is simply not a good idea at all.

Sorry but I am going to need to see where in the opf spec it says you can do that. It should have been % encoded and then no xml quoting or unquoting would be needed.

To workaround this, unzip the epub and use AddExisting to add the missing xhtml files. Sigil should properly % encode these when adding them to the opf.


Quote:
Originally Posted by Doitsu View Post
I was able to reproduce this issue with a file that was originally created with Calibre. If you add an ampersand to a file name in Calibre, it'll escape it as & instead of %26.

Apparently, the ampersand and the semicolon in & are escaped by Sigil and the file isn't found:

Code:
<item id="test.xhtml" href="Text/%26amp%3Btest.xhtml" media-type="application/xhtml+xml"/>

AFAIK, Calibre will sometimes add very long JSON-based metadata entries. I couldn't find an example, because I usually remove these entries. Hopefully, un_pogaz will provide an example.

Last edited by KevinH; 03-20-2021 at 02:07 PM.
KevinH is online now