0

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 ?

Olof
  • 524
  • 5
  • 20
  • 1
    In UTF-8, "é" is `\xC3\xA9`, but I guess the main issue is the output encoding of MsBuild.exe. Perhaps [this answer](http://stackoverflow.com/a/9223944/893780) can be of help. – robertklep Apr 12 '17 at 09:07
  • @robertklep you're right, the problem seem to come from MsBuild. Your link works only for log file, not for console. – Olof Apr 12 '17 at 09:49

0 Answers0