TXT to EPUB: encoding, chapters and a working table of contents
Prepare chapter headings, preview TXT encoding, edit the chapter list and verify a real EPUB navigation structure before using it in a reader.
Read the encoding preview first
Choose a plain-text file, select UTF-8, GB18030 or Big5, and read the preview. Strict UTF-8 validation is not universal encoding detection. Confirm only when the characters are readable. Pasted text already arrives as Unicode.
Check the chapter lines
For a small example, enter “Chapter 1 — Arrival”, a paragraph, then “Chapter 2 — Home” and another paragraph. Detect chapters, check their line numbers and levels, then edit the titles. Manual headings must be ordered and point to actual lines.
Export and reopen
Fill in the book title, author and language; optionally choose a JPEG or PNG cover. Export the EPUB and reopen it in the EPUB reader. Follow both chapter links and confirm the text is selectable. The output is EPUB 3, not a collection of page screenshots.
A small two-chapter example
Put every heading on its own line. After chapter detection, check that the opening paragraph belongs to the heading above it. A title appearing inside dialogue or a contents page can otherwise be mistaken for a real chapter start.
For a revision, keep the original TXT and the chapter choices together. Navigation in the generated EPUB describes that exact text version; adding lines or renaming headings later requires a new check rather than reusing old line positions.
| Checkpoint | Expected result | If it fails |
|---|---|---|
| Encoding preview | Names and punctuation are readable | Try the correct source encoding |
| Chapter editor | Two headings at intended lines | Edit heading positions |
| Reading order | Chapter 1 before Chapter 2 | Recheck source and heading order |
| Navigation | Both links open the correct text | Regenerate after correcting headings |
Chapter 1 — Arrival
Mira arrived before sunrise.
Chapter 2 — Home
The lamps were still on.Before you finish
- Confirm text is selectable in the exported book.
- Test long chapter titles and the final chapter.
- Check paragraph breaks in your intended reading app.
- Keep the source; an EPUB export is not your only editable master.
References
- W3C: EPUB 3.3
Background on EPUB publication structure and navigation. Reader layout and supported features vary.