node.js - child_process.exec producing "♀" character -


i have simple child_process.exec statement , output (stdout) has "♀" character @ beginning reason

var exec = require('child_process').exec; exec('echo hi', function (err, stdout) {     console.log(stdout); }); 

[scr]

my node v0.12 , have iojs installed v2.3. i've tested both separately same result. i've tested in different consoles - cmd.exe, powershell, , git's sh.exe, same result.

is character supposed present? if not, might producing it?

according child_process's documentation, object passed stdout buffer object. need decode before printing out string.

i modified code demonstrate how that. symbol no longer appears in console.

var exec = require('child_process').exec;  var stringdecoder = require('string_decoder').stringdecoder; var decoder = new stringdecoder('utf8');  exec('echo hi', function (err, stdout) {     var message = decoder.write(stdout);     console.log(message.trim()); }); 

for more detail string decoder, @ documentation here


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -