The expected output of the chcp command on Windows machines is like:
Active code page: 850
In that case the following code correctly provides the actual code page:
var codePage = stdout.replace(/\D/g, '');
But on some machines the output of chcp contains an error code, for instance:
"활占쏙옙 占쌘듸옙 占쏙옙占쏙옙占쏙옙: 949\r\n[0x7FFAF4317EA0] ANOMALY: meaningless REX prefix used"
In such a case the codePage becomes incorrect:
"9490743170"
instead of the expected "949"
This ends up later with errors like
Encoding not recognized: 'cp9490743170' ... (in iconv-lite actually)
May I suggest to retrieve the encoding differently, like:
var codePage = stdout.replace(/\n.*$/, '').replace(/\D/g, '');
or
var codePage = (/\d+/.exec(stdout)||[''])[0];
Hi,
The expected output of the chcp command on Windows machines is like:
Active code page: 850
In that case the following code correctly provides the actual code page:
var codePage = stdout.replace(/\D/g, '');
But on some machines the output of chcp contains an error code, for instance:
"활占쏙옙 占쌘듸옙 占쏙옙占쏙옙占쏙옙: 949\r\n[0x7FFAF4317EA0] ANOMALY: meaningless REX prefix used"
In such a case the codePage becomes incorrect:
"9490743170"
instead of the expected"949"
This ends up later with errors like
Encoding not recognized: 'cp9490743170' ...
(in iconv-lite actually)May I suggest to retrieve the encoding differently, like:
var codePage = stdout.replace(/\n.*$/, '').replace(/\D/g, '');
orvar codePage = (/\d+/.exec(stdout)||[''])[0];
Thanks.