-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
HTML writing fails on Windows if plot title contains specific UTF characters (≥) #3898
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
Comments
Interesting: if I replace the character by its UTF code, it actually says its cp1252 mapping is undefined:
|
The same error occurs with the latest JS, if |
I'm facing the same issue on windows and explicitly saving the plot as https://plotly.com/python-api-reference/generated/plotly.io.to_html.html#plotly.io.to_html html = fig.to_html()
with open(path, "w", encoding="utf-8") as f:
f.write(html) |
Does upgrading to 5.13 resolve this for you? |
Yes, that worked |
MWE:
Observations:
It seems like the call to
path.write_text(html_str)
does not specify the encoding and ends up trying to write UTF-8 characters into a cp1252-encoded stream on Windows. Apparently, cp1252 is the default Windows choice. The≥
character that breaks it all is present in both encoding tables, so saving should be possible.Note that the figure shows correctly before saving, so it's only a problem with HTML writing.
Also, this issue seems similar, though not the same:
#1289
The text was updated successfully, but these errors were encountered: