i ran into the following issue: whenever i serve the p5.min.js file, v2.0.5, from somewhere like amazon s3 or pinata i get the error in the image, when i serve with content type application/javascript, which is the standard content type for js files. when i change the content type to application/javascript; charset=utf-8, it works but i am wondering if this is the expected behaviour, as in pervious p5js versions that was never an issue.
This probably just means we have a unicode character somewhere in the source code. I’m not certain where the regular expression the error is complaining about is in the source code, but as a guess, it might be happening in a new dependency in 2.0, such as the new library we use to parse colors. Anyway, if the source code includes unicode characters, then it is normal and expected to serve it with the utf-8 charset
ok, i see thank you. some hosters / cdns will not let you manually set the content-type which causes problems in my case, but i understand that this might not be a priority for you.
I was wondering if this could be set on the page importing the script. It looks like you used to: <script>: The Script element - HTML | MDN
It now says, “the script
element inherits its character encoding from the document.” I think thats referring to inline scripts though? But you can try adding <meta charset="UTF-8">
to see if that helps.
You can also see if the charset attribute on the script tag still works since it’s an external file: HTML check: Element “script” must not have attribute “charset” unless attribute “src” is also specified. · Rocket Validator