Open faouzi-Lakhlifi opened 5 years ago
I read xml from a (~45mb) file then parse it then write it to another, works fine except for some characters mainly french accents, that turn into �; here's my code;
parser.parseString(fs.readFileSync('./files/file.xml','utf8'), function(err,result){ result["objectName1"]["objectName2"].Message.forEach(msg =>{ msg.content.objectName3.forEach(OCT => { OCT.stuff.forEach(ord => { ord[Object.keys(ord)[0]].forEach((O) => { lstobjects.push(O[Object.keys(O)[1]][0]) }) }) }) }) fs.writeFile('./files/object.txt',JSON.stringify(lstobjects),function(err,res){ if(err) console.log(err); console.log("Done") }) })
same issue..
I read xml from a (~45mb) file then parse it then write it to another, works fine except for some characters mainly french accents, that turn into �; here's my code;