When I read a JSON file in node.js the non-english character display as '?' instead of the origin character.
var fs = require('fs');
var path = require('path');
var stream = fs.createReadStream(path.join(__dirname,'../data.json'), 'utf8');
stream.on('error', function (error) {
response.status(500).send({ msg: error.message });
})
stream.pipe(response);
}
}
via Sari
No comments:
Post a Comment