Thanks for reporting this.
This was due to a planned change, although we did not sufficiently highlight what is going on in this case.
Recently we migrated the SINGLE_FILE mode to no longer use base64, but directly embed the binary content in a UTF-8 encoded string. However, this change requires that the served files are explicitly annotated to be encoded as UTF-8, or otherwise browsers default to legacy behavior, and assume Windows CP1252 encoding. (maybe on Windows only, not completely sure)
A quick fix is to add <meta charset='utf-8'> in the <head> section of the above index.html. That will cause the browser to change the defaults also for all downloaded .js files to UTF-8.
The PR
https://github.com/emscripten-core/emscripten/pull/25134
internally addressed the change in encoding, and I was thinking that
would transparently cover every use case. I.e. originally I had a mindset that users of SINGLE_FILE would all be doing "-sSINGLE_FILE -o foo.html", i.e. they'd be generating a single .html file as output.
Though in your above example, you are doing "-sSINGLE_FILE -o foo.js", to use the single file mode in a "two file" mode, by then manually providing a index.html file. That use then would not automatically get the UTF-8 encoding declaration.
Testing locally, I see that adding <meta charset='utf-8'> in the <head> section fixes up the test case.
Authored a PR
https://github.com/emscripten-core/emscripten/pull/25704 to help users be aware that declaring the UTF-8 encoding is now explicitly necessary for SINGLE_FILE mode - the legacy Windows CP1252 will unfortunately no longer work with SINGLE_FILE in binary encoding mode. If Windows CP1252 is needed for some reason, one can still fall back with -sSINGLE_FILE_BINARY_ENCODE=0 like Sam mentioned.