plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Weird Symbols show up when using Local version compared to CDN

Open tkalp opened this issue 1 year ago • 4 comments

Hello,

I am currently trying to plot a graph using plotly-cartesian.min.js. We are currently limited to downloading and using a local copy rather than the CDN. I am plotting a graph that use the tickformat '.1e' for the y axis.

When I run the code using the local version, I get some rather weird symbols when the values are between 0 and 1. It looks like there is some encoding issue but the html I am running has the tags <meta charset="utf-8" /> as well as the script has the charset specified.

When I run the CDN version, the values are what are to be expected so I am just wondering if there is something else I need to specify in the configuration of either the web server we are running, or within the html itself.

You can reproduce this by using the following.

  1. Open this code pen here
  2. You will see that the y-axis is formatted normally as expected.
  3. Now instead of using the CDN, copy paste the plotly-cartesian.min.js contents between the
  4. You will then see the weird characters show up.

This is the weird symbols using the local version

image

This is the normal version using the CDN

image

tkalp avatar Jul 17 '24 15:07 tkalp

image Exact same problem on me. Also using local version of plotly-2.32.0.min.js.

LonelyInstantN avatar Jul 26 '24 03:07 LonelyInstantN

Hello,

I am currently trying to plot a graph using plotly-cartesian.min.js. We are currently limited to downloading and using a local copy rather than the CDN. I am plotting a graph that use the tickformat '.1e' for the y axis.

When I run the code using the local version, I get some rather weird symbols when the values are between 0 and 1. It looks like there is some encoding issue but the html I am running has the tags <meta charset="utf-8" /> as well as the script has the charset specified.

When I run the CDN version, the values are what are to be expected so I am just wondering if there is something else I need to specify in the configuration of either the web server we are running, or within the html itself.

You can reproduce this by using the following.

  1. Open this code pen here
  2. You will see that the y-axis is formatted normally as expected.
  3. Now instead of using the CDN, copy paste the plotly-cartesian.min.js contents between the
  4. You will then see the weird characters show up.

This is the weird symbols using the local version

image This is the normal version using the CDN image

Hey, I found out just add <meta charset="utf-8"> to your html fix this problem;

LonelyInstantN avatar Jul 29 '24 02:07 LonelyInstantN

Thank you for the recommendation. Unfortunately, that does not fix our issue as mentioned in the original issue description. It may also be important to note that I am using nginx in a self-hosted configuration with docker. I've tried to change the config settings in the container to use the UTF-8 encoding as well, but no luck.

tkalp avatar Jul 29 '24 02:07 tkalp

hey @tkalp thanks for bringing this up. I found this because I had the same gibberish characters problem as you, but i didn't realize the CDN version worked. That gave me the idea the maybe if I downloaded a copy of the file using curl, rather than copying and pasting from the browser, it might fix it. And voila, it does.

tldr; don't copy and paste from the browser - use curl to download the file.

chris-ray avatar Aug 30 '24 16:08 chris-ray