Anatoly
Anatoly

Reputation: 99

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.

Upvotes: 4

Views: 8701

Answers (2)

Alexander Dark
Alexander Dark

Reputation: 31

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"},

Upvotes: 3

ill
ill

Reputation: 41

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.

Upvotes: 4

Related Questions