The default encoding to use is strict UTF-8, meaning that invalid Unicode triggers a SyntaxError.
Firefox also treats scripts as UTF-8, but uses replace mode instead, meaning that invalid UTF-8 are treated as 1-byte U+FFFD characters.
Using strict mode by default actually breaks several websites, which have Javascript files with comments in non-Latin alphabets (see #16089 for an example). Since the content of comments is never processed later on, such files still work normally, even when parsed as UTF-8, but only in replace mode.
P.S. Also the browser ignores the "charset" attribute on script tags.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too