You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

VSCode无法识别中文怎么办?已设置files.autoGuessEncoding仍无效

Fixing VS Code's Chinese Encognition Issue Despite Manual Encoding Switch

Hey there, I’ve dealt with this exact encoding frustration in VS Code before—let’s work through it together:

  • First, confirm your file’s actual encoding
    Sometimes the problem isn’t VS Code, but the file itself. Open it with a simple tool like Notepad++ and check the encoding shown in its bottom status bar. If the file isn’t actually saved in GB18030 or GBK, switching VS Code’s encoding won’t help. In that case, use Notepad++ to convert the file to your target encoding first (go to Encoding > Convert to GBK/GB18030) then reopen it in VS Code.

  • Force encoding for specific file types
    Auto-guessing can be hit-or-miss. You can tell VS Code to always use a specific encoding for certain file extensions. Open your settings.json and add lines like this:

    // For plain text files
    "[plaintext]": {
      "files.encoding": "gbk"
    },
    // For CSV files (adjust the file type as needed)
    "[csv]": {
      "files.encoding": "gb18030"
    }
    

    Replace the file type (like plaintext or csv) with the extension you’re working with, then save and restart VS Code.

  • Disable conflicting extensions
    Some third-party extensions (especially those related to encoding conversion or file formatting) can interfere with VS Code’s built-in encoding handling. Try disabling all your installed extensions, restart VS Code, and see if the Chinese displays correctly. If it does, re-enable extensions one by one to find the culprit.

  • Reset VS Code settings (as a last resort)
    If none of the above works, corrupted settings might be causing conflicts. Back up your settings.json first, then open the command palette (Ctrl+Shift+P or Cmd+Shift+P), run Preferences: Reset Settings, and set up your encoding options again from scratch.

内容的提问来源于stack exchange,提问作者Adrian

火山引擎 最新活动