Thursday, November 10, 2011

Non-allowed characters in filenames in EPUB

I got an email from a reader yesterday wondering about an error that iTunes Producer was giving as it rejected his EPUB submission to the iBookstore (despite having passed EpubCheck with nary a murmur), to wit:

ERROR ITMS-9000: "Invalid URI in NCX file Title Page.html :
Illegal character in path at index 5: Title Page.html" at Book
(MZItmspBookPackage)

When he converted the spaces to underscores, the errors went away and iTunes Producer accepted his book.

His book was originally created in InDesign, and it was InDesign that failed to convert the spaces to their hex equivalents so that iTunes Producer wouldn't choke.

Until Adobe updates its software, and for everyone who codes on their own or with some other tool, I recommend restricting filenames to the 26 unaccented letters of the English alphabet, the dash (-), and the underscore (_). That includes the names of documents in an InDesign book, images, videos, audio, CSS files you apply upon export, whatever.

Note that you can have spaces in titles, say Chapter 1, just not in filenames of those chapters, e.g., chapter1.xhtml.

A quick search on Mobile Read reveals that this is not a new issue.

Thanks so much to Edward Matte who brought this to my attention and shared his error reports and progress with me (and all of us).



9 comments:

  1. EpubCheck 3.0 beta 3 added a warning for this - "Title Page.xhtml: Filename contains spaces. Consider changing filename such that URI escaping is not necessary!"

    ReplyDelete
  2. This is good info Liz as I had the same problem when creating my ebook. Once I changed the file names, all went smoothly.

    ReplyDelete
  3. This is a new behavior in InDesign CS5.5. Previous versions properly replaced spaces with %20.

    Interestingly, CS5.5 does replace the spaces with %20 in the content.opf file. Just not the toc.ncx.

    ReplyDelete
  4. Thanks, Anne-Marie. I also noticed that despite that glaring mistake, the navigational TOC in iBooks and NOOK still work. Curious.

    ReplyDelete
  5. Something like this also occurs in Apple Pages EPUB export. I added a video with a filename that contained accented characters (Hungarian). Although it previewed fine in Pages, that video would not play in iBooks. Looking at the code directly, I could see many discrepancies between the filename in the <video tag and the actual file name of the video.

    ReplyDelete
  6. So you advice to use the same pattern for file name: A-Z and _ and -. Is'nt it? I produce EPUB with a my Java application.

    ReplyDelete
  7. I noticed the EPUBcheck is complaining about my filenames now, when it wasn't before. Is this something new to ePub 3? When I look at the 2.0.1 spec, under 3.3 File Names, it says nothing about a space under the MUST NOT section.

    ReplyDelete
  8. This is an old thread, but it was the first thing that came up when I googled for the issue I found, so I'll leave a comment: the current version of epubcheck online for a epub 2.0 file gives this warning if you have hyphens ( - ) in the files in the epub. Since hyphens do not have to be escaped in web addresses, there is no reason I can think of for them to give this warning unless maybe some e-pub readers have known problems with it.

    ReplyDelete
  9. THX THX THX THX THX THX THX a lots.. i was getting crazy with this warning.. having no experience with epub i was very difficult to make error free ebook.. it took nearly 2 months after finishing in word and started to make ebook. slowly cracking my brains and through internet tried solving problems but this was really tough one.. thanks again. now my epub is complete..

    ReplyDelete

More of my books