5

I followed the tutorial Build a digital book with EPUB to create an ePUB file.  The mimetype file contains only application/epub+zip and should not be compressed.  However, the zip commands that were recommended to achieve the non-compression of mimetype,

zip -0Xq   ebook.epub mimetype
zip -Xr9Dq ebook.epub *

...produce the following error when I run epubcheck:

ERROR: ebook.epub/mimetype: Mimetype file should contain only the string "application/epub+zip".

So I tried two other combinations of zip options, but the error stays the same.

zip -X  ebook.epub mimetype 
zip -rg ebook.epub META-INF 
zip -rg ebook.epub OEBPS

zip -X0  ebook.epub mimetype
zip -rX9 ebook.epub * -x mimetype

However, Calibre will open any of these Ebooks without any problems.

The content of my mimetype file is correct, so that it must be a problem with the zip commands. Or could this a bug of epubcheck?

Suzana
  • 309
  • 2
  • 13

3 Answers3

3

You need to remove the characters \n and \r from the mimetype file using Linux’s tr command as follows:

tr -d '\n' < mimetype   > mimetype.1
tr -d '\r' < mimetype.1 > mimetype.2
rm mimetype mimetype.1 
mv mimetype.2 mimetype

or simply

tr -d '\n\r' < mimetype > mimetype.2
mv mimetype.2 mimetype

And then you will have to add the file mimetype to the ePUB file using the following command:

zip -0Xq book.epub mimetype

Then you need to add remaining files to ePUB files as follows:

zip -Xr9Dq book.epub * -x mimetype -x book.epub 

Then just validate it using the online EPUB Validator and you will get a NO ERROR regarding mimetype.

ccpplinux
  • 46
  • 3
1

I'm using a Mac, running "ePub Zip/Unzip 3.0" (an Applescript that contains the correct zip commands, etc.) and I got this error too.

It turns out that both BBEdit and TextWrangler have a Preferences setting that automatically adds an additional line-break when you save. I unchecked that preference, and no more error.

Check your text editor to see if it has such a preference, and turn it off, if you can. (In BBEdit, it's called "Ensure file ends with line break" under the "Text Files" Preference.)

Best!

Todd

1

open the minetype file in dreamweaver or any text editing software and delete any spaces after the line that says 'application/epub+zip'. Make sure there isn't any returns as well.

That should work

toine
  • 11
  • 1