Epub output fails to validate.

I have not changed the settings but suddenly I get errors from epub validators for each chapter:
Error while parsing file ‘A document must not contain both a meta element in encoding declaration state (http-equiv=‘content-type’) and a meta element with the charset attribute present.’.
This is preventing my posting updated versions to smashwords, google play and others which require the file be validated.
epubfileanderrors.zip (554 KB)

I too am having the exact same error. Anyone with any help?

The error…

‘A document must not contain both a meta element in encoding declaration state (http-equiv=‘content-type’) and a meta element with the charset attribute present.’

…appears to relate to the highlighted line in the header of each XHTML file in the sample ePub:


I created a sample ePub using Scrivener’s default Ebook compile format. This produced a header without the errant line:


If you test compile to Scrivener’s default Ebook compile format, does the errant line disappear? If yes, we can try to identify what is causing the issue to appear in your compile settings.

As a workaround, it must be possible to edit each XHTML file to delete the problem lines (not ideal, obviously).

Slàinte mhòr.


I just had a chance to test this. I confirmed that this error appears with the standard eBook format when I use the following section layouts:

  • New Section
  • Section Text
  • Section with Title (bordered)
  • Section with Title

Each of my section types is assigned to one of those layouts. No compiled section type is unassigned.

This just in: This error appears to be caused by ticking the “Optimize for Kindle Conversion” in the Options panel of the main Compile dialog. Untick this, and the output ePub validates with no errors.

OK, L&L tech support, what’s happening?

This line should only be included if you are exporting to Kindle or have ticked “Optimize for Kindle Conversion”. As you might expect from the name of the latter option, ticking it creates an ePub file that is intended for conversion to the Kindle format. There is a problem whereby the Kindle does not respect the new HTML5 shorter declaration for file encoding (). This results in unicode characters such as accents and umlauts getting completely messed up unless the older, longer declaration is used. Thus, when creating Kindle files or ePubs with “Optimize for Kindle Conversion” ticked, the older version of the <meta…> line is inserted after the regular (correct) one to work around this Kindle bug.

Needless to say, if you want to generate an ePub that is not intended for Kindle conversion, you should not have that option ticked.

Cool. As of now, all my ePubs are intended for Kindle conversion, so I’ll just leave this on . Maybe if I get ambitious and decide to upload to Apple, Nook and Kobo directly instead of letting Smashwords and its Meatgrinder do the hard work, I’ll reconsider it. Nice to know that I can ignore that burp from the ePub validator, though. Thanks!