epub compile with ampersand in TOC

If you have an ampersand in the title of a chapter included in the contents, the TOC is not created correctly in the epub. It drops the item with the ampersand and all subsequent items from the TOC and drops the text of the chapter with the & in the title.

The file compiles correctly for mobi and compiles to epub correctly in the Mac version of Scriv.

Thanks, it looks like ampersands are not properly escaped and thus this generates invalid HTML. Opening the .epub file in Sigil with Tidy enabled will clean out the problem.

Actually, that might not be entirely true. The contents.xhtml file does contain a bare ‘&’ but the body*.xhtml file with the printed title and text content contains ‘&’. What are you using to view the ePub file? The whole thing is actually compiled. You can view it in the file system if you unzip it, or load it in Sigil. Maybe the viewer you are testing with is tripping up and halting.

Ok, this was a funny one. Testing in, it looks like the ampersands are encoded properly everywhere in the file, including in the contents.xhtml, but it breaks in Adobe Digital Editions. This appears to be due to the Windows compile also including a field in the head of the body.xhtml documents, and including the & there makes everything go crazy. So to fix this issue for now, just delete the text from the field and you should be fine. The Mac version doesn’t include these titles, which seems to be the crucial difference.

EDIT: The encoding is incorrect also in the generated toc.ncx file, which I’ve put in with the report.