PhpStorm终端出现异常字符,终端全字符乱码(如图)如何修复?
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+Son 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.exeto:
This sets the console to UTF-8 (code page 65001) before launching the terminal.cmd.exe /c chcp 65001 && cmd.exe
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.,
~/.bashrcfor Bash,~/.zshrcfor 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
- Windows:
- 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.

