In an Electron app, I run a windows executable (MsBuild.exe) with child_process.spawn and I display stdout in a div.
Some code :
var child = require('child_process');
const nuget = child.spawn(exec, parameters, { cwd: __dirname } );
nuget.stdout.on('data', (data) => {
var div = document.getElementById('div-console');
div.appendChild(document.createTextNode(data.toString()));
div.scrollTop = div.scrollHeight;
});
The stdout contains accented characters (éàè...). The 'é' character is represented with the number 130 (in Unicode, the 'é' is the 233 !). By default, child_process.spawn use UTF-8 encoding. Must I change the encoding ? If so, with wich encoding to use ?