Only tested in CP-949.
- This will only work on the codepages below.
- Windows codepages: 874, 1250-1258
- IBM codepages: 437, 737, 775, 808, 850, 852, 855-858, 860-866, 869, 922, 1046, 1124, 1125, 1129, 1133, 1161-116
- Multi-byte: 932, 936, 949, 950
Only tested in CP-949.
import Iconv from 'iconv-lite' | |
import child_process from 'child_process' | |
child_process.exec('chcp.com', { encoding: 'buffer' }, (err, stdout, stderr) => { | |
if(err) throw err; | |
const [ codepage ] = stdout.toString().match(/\d+/) | |
const buf = Iconv.decode(Buffer.from(stdout), 'cp'+codepage) | |
console.log(buf) | |
}) |