Description
Simply including the <script> via CDN doesn't working anymore when utf8 is missing. Some UTF RegEx couldn't be parsed.
Uncaught SyntaxError: Invalid regular expression: /[̀-ͯ]/g: Range out of order in character class https://cdn.plot.ly/plotly-4.0.0.js
Uncaught ReferenceError: Plotly is not defined
function sanitize(s) {
return s.normalize("NFD").replace(/[̀-ͯ]/g, "").normalize("NFC").toLowerCase().replace(/[ً-ٟ]/g, "").replace(/['‘’ʻʼʽˈ′`]/g, "").replace(/&/g, " and ").replace(/([,(])\s*the\b/g, "$1").replace(/[.(),[\]]/g, "").replace(/[-–—]/g, " ").replace(/\bst\b/g, "saint").trim().replace(/\s+/g, " ").replace(/^the\s+/, "");
}
The Sample from the ReadMe.md includes <script ... charset="utf-8">
But the examples on codepen doen't. They work on codepen but not when copied locally.
Ploty <= 3.7 didn't had this issue.
If only the sanitize function is introducing this problem I find it more beginner-friendly to remove these UTF8 RegEx.
Workarrounds
<script src="/?url=https%3A%2F%2Fcdn.plot.ly%2Fplotly-4.0.0.min.js" charset="utf-8">
<meta charset="UTF-8">
Steps to reproduce
<head>
<script src="https://cdn.plot.ly/plotly-4.0.0.js"></script>
</head>
<body>
<div id="gd"></div>
<script>
Plotly.newPlot("gd", /* JSON object */ {
"data": [{ "y": [1, 2, 3] }],
"layout": { "width": 600, "height": 400}
})
</script>
</body>
Notes
Tested on Edge, Firefox on German Windows 11
document.characterSet="windows-1252"
Webserver Debian Apache 2.4.68
Description
Simply including the <script> via CDN doesn't working anymore when utf8 is missing. Some UTF RegEx couldn't be parsed.
The Sample from the ReadMe.md includes
<script ... charset="utf-8">But the examples on codepen doen't. They work on codepen but not when copied locally.
Ploty <= 3.7 didn't had this issue.
If only the sanitize function is introducing this problem I find it more beginner-friendly to remove these UTF8 RegEx.
Workarrounds
<script src="/?url=https%3A%2F%2Fcdn.plot.ly%2Fplotly-4.0.0.min.js" charset="utf-8"><meta charset="UTF-8">Steps to reproduce
Notes
Tested on Edge, Firefox on German Windows 11
document.characterSet="windows-1252"
Webserver Debian Apache 2.4.68