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

Encode SVG image data as UTF-8 before calling lxml cleaner (fixes #1836) #1837

Merged
merged 1 commit into from
Aug 19, 2022
Merged

Conversation

emarsden
Copy link
Contributor

SVG image data generated by matplotlib contains an encoding header

"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n"

The clean_html function from lxml refuses to parse this (see #1836)

ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

To avoid the problem, encode the string to bytes before calling clean_html.

Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

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.

2 participants