danielfrg / pelican-jupyter

Pelican plugin for blogging with Jupyter/IPython Notebooks
Apache License 2.0
423 stars 105 forks source link

Fix UnicodeEncodeError in issue #54 #55

Closed ronanpaixao closed 7 years ago

ronanpaixao commented 7 years ago

This fixes issue #54. The first error was a non-error one. I just mistook it for an error because the error message had misplaced encoding.

The second error is in line 87. It appears the check for content attribute decode was bogus in two ways:

  1. content here may be str or unicode. I properly checked the correct type with six.binary_type.
  2. content was being decoded and then joined (through format()) to a unicode string, due to unicode_literals. This causes format() to try to decode the just-encoded bytes as ASCII, causing the error.

six as a new dependency shouldn't be a problem since it is recommended by the Pelican contributors blog and is also used by Pelican itself.

danielfrg commented 7 years ago

Thanks!