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

Error on saving interactive plot to HTML: UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f50d' in position 3366: character maps to <undefined> #26

Open
igorkf opened this issue Jun 3, 2024 · 3 comments

Comments

@igorkf
Copy link

igorkf commented Jun 3, 2024

Hello. First of all, this library is amazing!

I am trying to save the interactive plot to HTML, but I am getting this error:

UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f50d' in position 3366: character maps to <undefined>

It seems this Unicode char is a LEFT-POINTING MAGNIFYING GLASS:
https://www.fileformat.info/info/unicode/char/1f50d/index.htm

And I think this error in happening because I set enable_search=True, which includes a search box with a magnifying glass symbol on it:

plot = datamapplot.create_interactive_plot(
    coords,
    df['group'].values,
    hover_text=hover_data,
    cluster_boundary_polygons=False,
    color_cluster_boundaries=False,
    enable_search=True
)
plot.save('datamapplot.html')
plot

However, when setting enable_search=False, the HTML is saved fine.

P.S.: I am using Windows 10.

@lmcinnes
Copy link
Contributor

lmcinnes commented Jun 3, 2024

Hmm, I have not seen that issue on systems I've used (it seems to accept the magnifying glass just fine). Perhaps I can make the icon/character user settable. In the meantime you can solve the problem by editing these lines in your installation and simply replacing the magnifying glass character with something that will save correctly on your system (just the text "enter search query here" would do for example).

@igorkf
Copy link
Author

igorkf commented Jun 3, 2024

Hmm, I have not seen that issue on systems I've used (it seems to accept the magnifying glass just fine). Perhaps I can make the icon/character user settable. In the meantime you can solve the problem by editing these lines in your installation and simply replacing the magnifying glass character with something that will save correctly on your system (just the text "enter search query here" would do for example).

Thanks for the quick reply.
Just changed the magnifying glass to something like "Search: " and worked fine.

Thanks!

@rzo1
Copy link

rzo1 commented Oct 23, 2024

I am getting the error aboe as well in a Jupyter environment (via Docker).

Linux jupyter-xx 5.14.0-427.28.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 19 14:40:47 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux

LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

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

No branches or pull requests

3 participants