denoland / deno_graph

The module graph logic for Deno CLI
https://docs.rs/deno_graph
MIT License
112 stars 39 forks source link

fix: allow invalid utf8 when decoding modules #483

Closed sigmaSd closed 5 months ago

sigmaSd commented 5 months ago

fixes https://github.com/denoland/deno/issues/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 commented 5 months ago

CLA assistant check
All committers have signed the CLA.

sigmaSd commented 5 months ago

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

lucacasonato commented 5 months ago

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