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

fix: allow invalid utf8 when decoding modules #483

Merged
merged 1 commit into from
May 23, 2024

Conversation

sigmaSd
Copy link
Contributor

@sigmaSd sigmaSd commented May 22, 2024

fixes denoland/deno#23911

bun and node seems to work this way, since they don't error when importing clipper.js (but I haven't checked their code)

@CLAassistant
Copy link

CLAassistant commented May 22, 2024

CLA assistant check
All committers have signed the CLA.

@sigmaSd
Copy link
Contributor Author

sigmaSd commented May 22, 2024

The counter point is maybe its the responsibility of the module author to not use invalid utf8
But node and bun accepts it

@dsherret dsherret requested a review from lucacasonato May 23, 2024 14:30
@lucacasonato
Copy link
Member

This is correct.

Let sourceText be the result of UTF-8 decoding bodyBytes.

https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script

Process a queue with an instance of UTF-8’s decoder, ioQueue, output, and "replacement".

https://encoding.spec.whatwg.org/#utf-8-decode

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

Successfully merging this pull request may close these issues.

fails to import a module because of invalid utf8 sequence
4 participants