nodejs调用系统命令,输出结果中文乱码问题

var child_process = require('child_process');
var iconv = require('iconv-lite');
var encoding = 'cp936';
var binaryEncoding = 'binary';

child_process.exec('svn log', { encoding: binaryEncoding }, function(err, stdout, stderr){
    console.log(iconv.decode(new Buffer(stdout, binaryEncoding), encoding), iconv.decode(new Buffer(stderr, binaryEncoding), encoding));
});

http://ask.csdn.net/questions/167560

你可能感兴趣的:(nodejs调用系统命令,输出结果中文乱码问题)