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: save_png doesn't work when character \xa0 is used #1644

Merged
merged 1 commit into from
May 21, 2024

Conversation

mariobuikhuizen
Copy link
Contributor

The character \xa0 is converted to   when .outerHTML() is called, causing an error in the data-URL where the outer HTML is used.

Code changes

Revert &nbps;, generated by .outerHtml(), back to the original character \xa0.

User-facing changes

save_png() will now work when \xa0 is used.

Steps to reproduce

Run the following:

from bqplot import *

x_sc = LinearScale()
y_sc = LinearScale()

scatter_chart = Scatter(x=x_data, y=y_data, scales={'x': x_sc, 'y': y_sc})

x_ax = Axis(label='X', scale=x_sc)
y_ax = Axis(label='Y', scale=y_sc, orientation='vertical')

fig = Figure(title="Ti \xa0 tle", marks=[scatter_chart], axes=[x_ax, y_ax])
fig
fig.save_png("fig.png")

Notice the save dialog is not appearing.

The dataURL produced with  :
Screenshot 2024-04-30 at 17 11 00

The character \xa0 is converted to   when .outerHTML() is
called, causing an error in the data-URL where the outer HTML is
used.
@mariobuikhuizen
Copy link
Contributor Author

Some other unicode characters are converted to entites, like \u2003 ->   and
\u2009 ->  , but they just work.

@maartenbreddels maartenbreddels merged commit 4d5c293 into bqplot:master May 21, 2024
8 checks passed
@maartenbreddels
Copy link
Member

We looked into this a bit, but documentation is scarce on this, and this is at least an improvement. Thanks @mariobuikhuizen

@maartenbreddels
Copy link
Member

meeseeksdev please backport to 0.12.x

Copy link

lumberbot-app bot commented May 21, 2024

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout 0.12.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 4d5c2932d8d55e1af96e7129f0550c18c0c3b977
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am "Backport PR #1644: fix: save_png doesn't work when character \\xa0 is used"
  1. Push to a named branch:
git push YOURFORK 0.12.x:auto-backport-of-pr-1644-on-0.12.x
  1. Create a PR against branch 0.12.x, I would have named this PR:

"Backport PR #1644 on branch 0.12.x (fix: save_png doesn't work when character \xa0 is used)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

maartenbreddels pushed a commit to maartenbreddels/bqplot that referenced this pull request May 21, 2024
The character \xa0 is converted to   when .outerHTML() is
called, causing an error in the data-URL where the outer HTML is
used.

(cherry picked from commit 4d5c293)
maartenbreddels pushed a commit to maartenbreddels/bqplot that referenced this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants