Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

All Russian letters change to "????" in Visual Studio Code

Every time I save and run a file through VSCode, all Russian letters change to "????".

Screenshot

like image 213
John Shevchenko Avatar asked Oct 29 '25 18:10

John Shevchenko


1 Answers

According to the status bar you've opened the file as Windows-1252. That's the default ANSI codepage for Windows OS in Western Europe and it cannot store Cyrillic characters at all.

enter image description here

I suggest you take a minute to set a proper default configuration for these two directives:

// The default character set encoding to use when reading and writing files. This setting can be configured per language too.
"files.encoding": "utf8",

// When enabled, will attempt to guess the character set encoding when opening files. This setting can be configured per language too.
"files.autoGuessEncoding": false,

Pick a different encoding if you aren't using UTF-8 in a general basis. You may also enable files.autoGuessEncoding if you typically mix different encodings, but be aware that it isn't magic (there's no reliable way to detect text encoding programmatically, not at least in a simple tool like a text editor).

These directives can also be set in a per-project basis and even in a per type file basis. Additionally, current file can entirely bypass prior settings; the simplest way is to click on the encoding name in the status bar and pick a command:

  • Reopen with Encoding renders the file with a different encoding. It doesn't alter the file.

  • Save with Encoding converts the file to another encoding. It does modify the file thus you need to ensure that source encoding is correct.

like image 102
Álvaro González Avatar answered Nov 01 '25 10:11

Álvaro González



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!