'Accented characters break when read from file
I'm trying to console.log all the lines from a files that as multiples lines with words like:
Mansões
Maracanã
Filadélfia
Califórnia
To do that I'm using readline with fs:
const rl = readline.createInterface({
input: fs.createReadStream(BASE_PATH + 'word.TXT', { encoding: 'utf8'})
});
rl.on('line', function (line) {
console.log(line);
});
But it is logging on the terminal like:
Mans�es
Maracan�
Filad�lfia
Calif�rnia
Currently using: Nest.js + readline + fs.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
