wcember / pypub

Python library to programatically create epub files
MIT License
278 stars 44 forks source link

error Entity not defined #5

Closed marcogoldin closed 8 years ago

marcogoldin commented 8 years ago

Hi, i upgraded to the new version via pip, but just like in the previous one you get the same error (a similar one) in the rendered epub.

This page contains the following errors: error on line 277 at column 15: Entity 'mdash' not defined Below is a rendering of the page up to the first error.

Could it be a problem with Beautiful Soup, unicode and entities? thank you

wcember commented 8 years ago

Ahhhhhh...I dug a little into this, and this behavior was intentional, at least kind of.

Specifically, I have pypub set right now to convert unicode entities whenever possible to HTML entities. More specifically, this is being done in line 103 of the clean.py file, where the argument formatter='html' is passed into the function, which forced Beautiful Soup to convert unicode entities to html entitities

What epub reader are you using? In the past when I've tried to view things on my kindle (after converting the generated epubs to mobi), I've gotten errors with unicode, which is why I implemented this as is.

Thanks,

Bill