You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PhpStorm终端出现异常字符,终端全字符乱码(如图)如何修复?

Fixing Garbled Text & Weird Characters in PhpStorm Terminal

Hey there! Sorry to hear you're stuck with garbled text and strange characters in your PhpStorm terminal—let's walk through some tried-and-true fixes to get it back to normal.

1. Check Terminal Encoding Settings

Encoding mismatches are the most common culprit here:

  • Open PhpStorm's settings (File > Settings or press Ctrl+Alt+S on Windows/Linux, Cmd+, on macOS)
  • Navigate to Tools > Terminal
  • Under the "Shell path" section, set the Default encoding to UTF-8 (this is the universal standard for most modern systems)
  • For Windows users: If your system console uses a different encoding, tweak the shell path to force UTF-8. Change the default cmd.exe to:
    cmd.exe /c chcp 65001 && cmd.exe
    
    This sets the console to UTF-8 (code page 65001) before launching the terminal.

2. Switch to a Character-Safe Font

Some fonts don't support special characters, leading to garbled display:

  • In Tools > Terminal, find the Font dropdown
  • Switch to a font designed for code, like JetBrains Mono (PhpStorm's default, optimized for IDEs), Consolas, or Source Code Pro
  • Restart the terminal in PhpStorm to see if the issue clears up.

3. Configure Shell Environment Variables (Linux/macOS)

If you're on Linux or macOS, your shell might be using an outdated encoding setting:

  • Open your shell's config file (e.g., ~/.bashrc for Bash, ~/.zshrc for Zsh) in a text editor
  • Add these lines to force UTF-8 encoding:
    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8
    
  • Save the file, then restart PhpStorm or open a new terminal tab to apply the changes.

4. Disable Terminal Emulation in Run Configurations

Sometimes the "emulate terminal" option causes rendering glitches:

  • Go to Run > Edit Configurations
  • Select the configuration you use (e.g., PHP CLI, Composer)
  • Uncheck the box for Emulate terminal in output console
  • Rerun your task to see if the text displays correctly.

5. Reset PhpStorm Terminal Configuration

If all else fails, resetting the terminal config can fix corrupted settings:

  • Close PhpStorm completely
  • Locate the terminal config file:
    • Windows: C:\Users\<YourUsername>\.PhpStorm<Version>\config\options\terminal.xml
    • Linux: ~/.PhpStorm<Version>/config/options/terminal.xml
    • macOS: ~/Library/Application Support/JetBrains/PhpStorm<Version>/options/terminal.xml
  • Backup the file (copy it to another folder) then delete the original
  • Restart PhpStorm—it will generate a fresh, default terminal config.

If none of these work, try updating PhpStorm to the latest stable version—sometimes bugs related to terminal rendering get fixed in newer releases.

内容的提问来源于stack exchange,提问作者Diego Jauregui S.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:39:01