# Epub export introduces &nbsp; and fails

**URL:** <https://pressbooks.community/t/epub-export-introduces-nbsp-and-fails/2601>\
**Category:** Importing & Exporting Content\
**Created:** [December 21, 2023, 8:50pm UTC](https://pressbooks.community/t/epub-export-introduces-nbsp-and-fails/2601 "2023-12-21T20:50:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrizquierdo](https://pressbooks.community/user_avatar/pressbooks.community/lrizquierdo/32/870_2.png) [@lrizquierdo](https://pressbooks.community/u/lrizquierdo)\
**Post date:** [December 21, 2023, 8:50pm UTC](https://pressbooks.community/t/epub-export-introduces-nbsp-and-fails/2601/1 "2023-12-21T20:50:55Z")

</div>

Hi,

My epub exports introduce `&nbsp;` in some regular spaces and fails. For instance, the following text (copied and pasted from the Pressbooks editor):

> The objective of this book is to help you learn to _implement_ and _analyze_ evolutionary models of social interactions in finite populations.

is parsed in the epub file as:

`<p>The objective of this book is to help you learn&nbsp;to <em>implement</em> and <em>analyze</em> evolutionary models of social interactions in finite populations.</p>`

which leads to errors in the export:

FATAL(RSC-016): /srv/www/wisc.pb.unizin.org/releases/20231207215206/web/app/uploads/sites/28/pressbooks/exports/Agent-Based-Evolutionary-Game-Dynamics-IN-PROGRESS-1703189423.epub/EPUB/front-matter-001-preface.xhtml(19,150): Fatal Error while parsing file: The entity “nbsp” was referenced, but not declared.

These errors mean that the page cannot be read in the EPUB file:

 ![Screenshot 2023-12-21 at 12.46.33](https://pressbooks.community/uploads/default/original/2X/0/0c852d9272edddf4be227ffc97e42e62670618eb.png)

These errors also occur in HTML book exports, but I read [here](https://pressbooks.community/t/word-formatting-not-retained-parser-errors/976) that is better not to use that format.

I was not getting errors with the EPUB exports until recently. Now I get a lot of them:

 ![Screenshot 2023-12-21 at 12.36.52](https://pressbooks.community/uploads/default/original/2X/c/cb7e1cf249a576ae48436fa728162415e4987a11.png)

Any ideas about how to fix this?  
Thanks a lot,  
Luis

---

<div class="post-metadata">

**Author:** ![SteelWagstaff](https://pressbooks.community/user_avatar/pressbooks.community/steelwagstaff/32/1280_2.png) [@SteelWagstaff](https://pressbooks.community/u/SteelWagstaff)\
**Post date:** [December 21, 2023, 9:15pm UTC](https://pressbooks.community/t/epub-export-introduces-nbsp-and-fails/2601/2 "2023-12-21T21:15:04Z")

</div>

hi @lrizquierdo sounds frustrating. This looks like a bug in our export routine. Are you open to filing this as an issue in our pressbooks/pressbooks repo? [Issues · pressbooks/pressbooks · GitHub](https://github.com/pressbooks/pressbooks/issues)

---

<div class="post-metadata">

**Author:** ![lrizquierdo](https://pressbooks.community/user_avatar/pressbooks.community/lrizquierdo/32/870_2.png) [@lrizquierdo](https://pressbooks.community/u/lrizquierdo)\
**Post date:** [December 21, 2023, 9:55pm UTC](https://pressbooks.community/t/epub-export-introduces-nbsp-and-fails/2601/3 "2023-12-21T21:55:05Z")

</div>

Thanks so much for the quick response Steel! I hope you’re doing great.  
I have filed an issue for this: [Epub export introduces &nbsp; and fails · Issue #3539 · pressbooks/pressbooks · GitHub](https://github.com/pressbooks/pressbooks/issues/3539)

---

<div class="post-metadata">

**Author:** ![webistrator](https://pressbooks.community/letter_avatar_proxy/v4/letter/w/c2a13f/32.png) [@webistrator](https://pressbooks.community/u/webistrator)\
**Post date:** [March 13, 2025, 11:02pm UTC](https://pressbooks.community/t/epub-export-introduces-nbsp-and-fails/2601/4 "2025-03-13T23:02:37Z")

</div>

Have you tried replacing the &nbsp; with an ASCII or Unicode nbsp character code?
