JS: Fix encoding conversion from utf16 to utf8 (#131)

This commit is contained in:
Sebastian Miasojed
2024-12-11 09:23:02 +01:00
committed by GitHub
parent 2cb8f82266
commit afe44ad21b
7 changed files with 52 additions and 81 deletions
+2 -16
View File
@@ -29,24 +29,10 @@ onmessage = async function (e) {
m.soljson = Module;
// Set input data for stdin
m.setStdinData(JSON.stringify(sourceCode));
var stdoutString = "";
m.setStdoutCallback(function(char) {
if (char.charCodeAt(0) === '\n') {
console.log("new line")
exit
}
stdoutString += char;
});
var stderrString = "";
m.setStderrCallback(function(char) {
stderrString += char;
});
m.writeToStdin(JSON.stringify(sourceCode));
// Compile the Solidity source code
m.callMain(['--standard-json']);
postMessage({output: stdoutString || stderrString});
postMessage({output: m.readFromStdout() || m.readFromStderr()});
};