NeuroAgent

How to Fix Cyrillic Display in VS Code Without UTF-8 Beta Test

Solution for fixing Cyrillic display issues in VS Code without enabling UTF-8 beta test. Encoding settings, terminal configurations, and alternative methods for proper Russian character display.

Question

How to fix incorrect Cyrillic display in VS Code?

Problem: When running code in VS Code, Cyrillic text displays as hieroglyphs.

Current situation:

  • UTF-8 beta testing in Windows is disabled
  • When UTF-8 beta testing is enabled in VS Code, Cyrillic displays correctly
  • However, enabling UTF-8 beta testing causes issues with another program (Access) - it stops launching
  • In Access, Cyrillic only displays correctly when UTF-8 beta testing is disabled

Question: How can the Cyrillic display issue in VS Code be resolved without having to constantly enable/disable UTF-8 beta testing for each program?

NeuroAgent

The main issue with displaying Cyrillic text in VS Code on Windows occurs due to conflicts between VS Code’s encoding settings and Windows system settings. Several solutions are available that don’t require constantly enabling/disabling the UTF-8 beta test.


Table of Contents


VS Code Settings for Correct Cyrillic Display

The primary solution to the problem without enabling the UTF-8 beta test is to configure encoding parameters directly in VS Code. Add the following settings to your settings.json file:

json
{
  "files.encoding": "utf8",
  "files.autoGuessEncoding": true,
  "terminal.integrated.defaultProfile.windows": "Command Prompt",
  "terminal.integrated.profiles.windows": {
    "Command Prompt": {
      "path": "cmd.exe",
      "args": ["/K", "chcp 65001"]
    }
  }
}

Explanation:

  • files.encoding: "utf8" sets UTF-8 as the default encoding for all files
  • files.autoGuessEncoding: true enables automatic encoding detection when opening files
  • The terminal settings ensure that the command prompt will use UTF-8 (via chcp 65001)

Changing Encoding for Specific Files

For individual files that already contain Cyrillic text, you can change their encoding without modifying global settings:

  1. At the bottom of the VS Code window, you’ll see an encoding label (usually “UTF-8”)
  2. Click on this label
  3. In the menu that appears, select “Save with encoding”
  4. Choose the appropriate encoding:
    • UTF-8 - for most cases
    • UTF-8 with BOM - if the file was created with a byte order mark
    • Windows 1251 - if the file was originally in this encoding

Important: When saving a file with Cyrillic text in UTF-8 encoding without BOM, ensure that all UTF-8 supporting editors can open it correctly.


VS Code Terminal Settings

Issues with displaying Cyrillic text often occur specifically in console output. To resolve this issue:

  1. Open VS Code settings (Ctrl+,)
  2. Add the setting:
    json
    "terminal.integrated.defaultProfile.windows": "Command Prompt"
    
  3. Or create a terminal profile with explicit encoding setup:
json
"terminal.integrated.profiles.windows": {
  "UTF-8 Command Prompt": {
    "path": "cmd.exe",
    "args": ["/K", "chcp 65001 && title UTF-8 Terminal"]
  }
}

Alternative Solution Methods

Using Third-Party Extensions

Install the “Code Runner” extension from Marketplace. It allows you to run code in the terminal with proper encoding:

  1. Install the “Code Runner” extension by Jun Han
  2. In settings, add:
    json
    "code-runner.executorMap": {
      "javascript": "cd $dir && node $fileName",
      "python": "cd $dir && python $fileName",
      // other languages...
    }
    

Changing Windows System Settings

If the problem persists, you can change the system locale without enabling the UTF-8 beta test:

  1. Press Win + R, type intl.cpl
  2. Go to the “Administration” tab
  3. Click “Change system locale”
  4. In the “Non-Unicode programs language” section, uncheck “Beta: Use Unicode UTF-8 for worldwide language support”
  5. Select an appropriate language (e.g., Russian)
  6. Restart your computer

Preventing Conflicts with Other Programs

To avoid conflicts with MS Access and other programs that don’t work with the UTF-8 beta test, use the following strategy:

  1. Configure VS Code separately for working with Cyrillic text through files.encoding

  2. Use different Windows profiles for different tasks:

    • Profile for development with UTF-8 beta test enabled
    • Profile for working with Access with UTF-8 beta test disabled
  3. Create a batch script for quick mode switching:

batch
@echo off
echo Enabling UTF-8 for VS Code...
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage" /v "ACP" /t REG_SZ /d "65001" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage" /v "OEMCP" /t REG_SZ /d "65001" /f
echo UTF-8 enabled. Please restart VS Code.
pause

Save this script as enable_utf8.bat and run it before working with VS Code.


Sources

  1. Character encoding - All Russian letters change to “???” in Visual Studio Code - Stack Overflow
  2. Change the encoding of a file in Visual Studio Code - Stack Overflow
  3. VS Code doesn’t correctly display Russian letters · Issue #41401 · microsoft/vscode
  4. Visual studio code Change encoding for single files and Permanently - w3schools
  5. How to change File Encoding in VS Code - DeveloperF1.com

Conclusion

To solve the problem of displaying Cyrillic text in VS Code without enabling the UTF-8 beta test, we recommend:

  1. Primary solution: Configure files.encoding: "utf8" and files.autoGuessEncoding: true in VS Code settings
  2. Additional measures: Change encoding for specific files through the VS Code interface
  3. For the terminal: Set UTF-8 encoding via chcp 65001 in terminal settings
  4. Alternative: Use the Code Runner extension or change Windows system settings
  5. For preventing conflicts: Create separate Windows profiles or use scripts for mode switching

These methods will allow correct display of Cyrillic text in VS Code without affecting other programs such as MS Access.