Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code can't encode cyrillic characters in output

Output in Visual Studio Code can't decode Cyrillic characters:

Visual Studio Code can't decode Cyrillic characters

The same code works fine in PyCharm:

The same code works fine in PyCharm

How do I quickly fix this issue? There must be some simple way.

Auto Guess Encoding in Settings doesn't work since it's for files, not the output.

Edit: the problem was the Code Runner extension in VSCode. Disabling it or running script in terminal does the job.

like image 298
Anatoly Avatar asked Sep 19 '25 15:09

Anatoly


2 Answers

You can configure 'Code Runner' plugin to run your code in the integrated terminal.

Try it:

  1. Open VSC Settings: Ctrl + ,
  2. Search: code runner run in terminal
  3. Click on checkbox.

Now your application with Cyrillic symbols run in Integred Terminal without encoding problems.

like image 110
ill Avatar answered Sep 21 '25 05:09

ill


The problem lies in the Code Runner encoding itself, since the text is displayed correctly in the terminal.

You can add into settings.json :

"code-runner.executorMap": {"python": "set PYTHONIOENCODING=utf8 && py -u"},

like image 22
Alexander Dark Avatar answered Sep 21 '25 06:09

Alexander Dark