I'm trying read from a file (The file is in Bulgarian) and with utf 8 it returns nonsense characters so I tried cp1251 but it throws: ERR_INVALID_OPT_VALUE_ENCODING.
var str = fs.readFileSync("./bank1/"+client,'cp1251');
I'm trying read from a file (The file is in Bulgarian) and with utf 8 it returns nonsense characters so I tried cp1251 but it throws: ERR_INVALID_OPT_VALUE_ENCODING.
var str = fs.readFileSync("./bank1/"+client,'cp1251');
You should add the encoding option as an object like so:
var str = fs.readFileSync("./bank1/"+client, { encoding: 'cp1251' });
Hope it helps.