# 2.0.5 content-type issue

**URL:** <https://discourse.processing.org/t/2-0-5-content-type-issue/47189>\
**Category:** p5.js\
**Created:** [September 22, 2025, 12:03pm UTC](https://discourse.processing.org/t/2-0-5-content-type-issue/47189 "2025-09-22T12:03:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pifragile](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@pifragile](https://discourse.processing.org/u/pifragile)\
**Post date:** [September 22, 2025, 12:03pm UTC](https://discourse.processing.org/t/2-0-5-content-type-issue/47189/1 "2025-09-22T12:03:58Z")

</div>

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.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/5/1508d6afdeac56b6b4ffc772e7cb7ed6f25950a7.png)

---

<div class="post-metadata">

**Author:** ![davepagurek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/davepagurek/32/17535_2.png) [@davepagurek](https://discourse.processing.org/u/davepagurek)\
**Post date:** [September 22, 2025, 1:10pm UTC](https://discourse.processing.org/t/2-0-5-content-type-issue/47189/2 "2025-09-22T13:10:51Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![pifragile](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@pifragile](https://discourse.processing.org/u/pifragile)\
**Post date:** [September 27, 2025, 7:33am UTC](https://discourse.processing.org/t/2-0-5-content-type-issue/47189/3 "2025-09-27T07:33:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davepagurek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/davepagurek/32/17535_2.png) [@davepagurek](https://discourse.processing.org/u/davepagurek)\
**Post date:** [September 27, 2025, 10:23am UTC](https://discourse.processing.org/t/2-0-5-content-type-issue/47189/4 "2025-09-27T10:23:49Z")

</div>

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](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script#charset)

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](https://rocketvalidator.com/html-validation/element-script-must-not-have-attribute-charset-unless-attribute-src-is-also-specified)

---

<div class="post-metadata">

**Author:** ![pifragile](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@pifragile](https://discourse.processing.org/u/pifragile)\
**Post date:** [October 9, 2025, 4:36pm UTC](https://discourse.processing.org/t/2-0-5-content-type-issue/47189/5 "2025-10-09T16:36:52Z")

</div>

yes, absolutely, that did the trick.

```auto
<script src="./p5.min.js" charset="utf-8"></script>

```

thanks 🙂
