0

When I use any characters from utf-8 encoding, I see the following ������ both in console and browser:

console.log("привет");
res.send("привет");

I noticed this for every new nodejs project in Visual Studio. I opened one of my old projects, it works fine there. Can't track the root cause

  • Please check your file encoding, when you save file you save the file as ASCII or UTF-8, may be your file saved as UTF-8 – Dickens A S Mar 25 '22 at 09:01
  • Thank you! Correct, wrong encoding of file. Actually issue with Visual Studio it saved file in wrong encoding, and when select Save As and select encoding it just return some error. Please post it as answer, I will confirm resolved – Andrei Charnyshou Mar 25 '22 at 09:19
  • Here the step to change it: https://stackoverflow.com/questions/30082741/change-the-encoding-of-a-file-in-visual-studio-code#answer-40365121 – Gabriel Rodríguez Flores Mar 25 '22 at 11:39

1 Answers1

1

sometimes if you save a file there will be an option to choose encoding as ASCII or UTF-8

your file might got saved to accept Unicode's so if you save your file as ASCII this issue will be resolved

Dickens A S
  • 3,824
  • 2
  • 22
  • 45