When attempting to convert a PDF to EPUB, Calibre halts with UnicodeDecodeError: 'utf8' codec can't decode byte 0xe0 in position 1209: invalid continuation byte.

I created the PDF with Debian 10; the file opens and displays with evince and with Calibre. There is no math and no illustrations; the file is a text-only Bible study. I created a LaTeX class file based on article.cls, because I needed to alter the quotation environment.

I tried to use tex4ebook, but it complained about the .cls file. Calibre conversion failed with a PDF created by pdflatex and with a PDF created with ps2pdf.

  • 1
    The UnicodeDecodeError has nothing to do with LaTeX, but is related to Python not being able to read the file as UTF-8 (Calibre might use Python there).
    – epR8GaYuh
    Jun 29, 2021 at 5:35
  • I discarded my custom .cls and reverted to article.cls. That made the error go away, even in tex4ebook. But now the layout is so ugly that I may offer only pdf. Also, the output of tex4ebook looks much nicer than the output of calibre.
    – russ
    Jun 29, 2021 at 5:53
  • You will probably need to write a configuration file for tex4ebook if you use a custom class. Could you update your question. With a MWE? It cannot be answered without more information.
    – michal.h21
    Jun 29, 2021 at 6:17


You must log in to answer this question.

Browse other questions tagged .