sphinx-doc / sphinx-doc/sphinx
Quotes and m-dashes are not properly escaped in epub
Open
Nobody has claimed this yet.
builder:epub
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Subject: missing escapes in epub builder
Problem
- I'm trying to go from sphinx to mobi for Kindle. I'm using the
epubbuilder with theepubtheme onsphinx 1.8.3and then passing tokindlegen - Most stuff works but all the "smart quotes" and m-dashes and whatnot are coming out as goofy characters in mobi, like
’instead of an apostrophe and–instead of m-dash. - If I turn off
smartquotesthe apostrophe's work but not the m-dashes.
The rst looks like:
*****
Intro
*****
Computers are everywhere. They're in our purses, our offices, our TV's, our hobby-dens,
our cars, and our toasters. Many of us spend significant parts of our days operating these
The xhtml source for the epub looks like this:
<h1>Intro</h1>
<p>Computers are everywhere. They’re in our purses, our offices, our TV’s, our hobby-dens,
our cars, and our toasters. Many of us spend significant parts of our days operating these
Procedure to reproduce the problem
make epub
# epub viewers sometimes show these characters ok, but once
# you run kindlegen they go to the weird chars
kindlegen _build/epub/book.epub
Expected results
I'd expect it to be They’re in our purses instead of the special apostrophe or something like that in the xhtml source on the way into the epub.
Environment info
- OS: Ubuntu 18.10
- Python version: 3.6.7
- Sphinx version: 1.8.3
- KindleGen v2.9 for Linux 2.6 i386
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the mentioned epub builder using make epub, then pass _build/epub/book.epub to kindlegen and inspect the generated XHTML. Trace the epub builder's character handling and add a regression check for smart quotes and m-dashes; done means KindleGen no longer produces mojibake.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100