Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unicode errors when rendering to IPython notebook #68

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

remram44
Copy link
Contributor

Kinda-fixes PyCQA/baron#66: the example notebook linked there now works (if input is bytes).

Do no make Pygments encode highlighted source code, keep unicode. This
is already done for NodeList and ProxyList, fix Node and EndlNode.
NodeList and ProxyList do a unicode join() to construct the final
unicode object; ths makes every element unicode to begin with, to avoid
automatic decoding.
@Psycojoker
Copy link
Member

Hello,

Do you think that it's possible to write a test for that? Nevertheless, thanks a lot for this pull request :)

Kinds regards,

@remram44
Copy link
Contributor Author

I'm sure I can make you something... There's a risk I might find other unicode-related issues though 😉

@ibizaman
Copy link
Collaborator

That would be great!

@remram44
Copy link
Contributor Author

As I thought, RedBaron() expects bytes on Python 2 and str on Python 3 😢

I added a test, but it doesn't pass on Python 3: it looks like .node_list gives out a list instead of a NodeList, so _repr_html_() doesn't exist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Baron fails on non-ASCII unicode input
3 participants