-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Unicode issue in tooltips on Jupyter notebook #1320
Comments
I can confirm this is indeed an issue, on Jupyter notebooks only. The encoding is set correctly to utf-8 in both the notebook frame and the map iframe. Since the characters display correctly in the layer control, it's unlikely an issue with the file encoding. This issue seems specific to the tooltip. It also happens for popups. The characters appear garbled in the html:
It's already broken in the JS code that generates that html:
In the JS code for the layer control the same string is properly encoded though:
|
Any idea where the problem lies? I tried to have a look at it and couldn't see anything obvious. Did some poking around as well but couldn't make any headway |
I think I found the issue. In branca we encode the html for in the notebook. This uses When the notebook rehydrates this code it uses The solution is to encode the html not as utf-8, but using I'll open a PR in branca with this fix. You could really help by testing that fix! |
@galewis2 did you get a chance to test the PR? I'd merge it with more confidence if you could confirm it indeed solves your issue.
|
A fix has been merged in the branca library. It will be availabe in the next release, release date yet unknown. If you want it earlier you can install branca from the git main branch:
|
@michelmetran I had the same problem with Swedish åäö not rendering properly, and
|
This still seems to be a problem on Folium 0.11.0 (as present on Kaggle). I have to use this workaround: to display a string such as:
I have to use this workaround:
|
I think it's an issue with js atob. JavaScript built-in functions btoa and atob do not support Unicode strings. I use the atou function I get on the MDN portal
|
This was fixed in python-visualization/branca#76 and will be in branca version 0.4.2, which hasn't been released yet but will be soon. |
It also works for the greek alphabet, thank you a lot! |
MVP:
I'm running in Jupyter Lab with Python3.7 and latest Folium version (0.10.1+28.ga8ec61d which is with my PR)
Is there a workaround for this?
The text was updated successfully, but these errors were encountered: