Fix Garbled Characters in PuTTY SSH
Solve encoding issues and display text correctly in your terminal
Why SSH Output Shows Gibberish
Garbled characters (often called "mojibake" or "δΉ±η " in Chinese) appear when there's a mismatch between:
- The character encoding PuTTY expects
- The character encoding the server sends
- The locale settings on the remote system
- The font used in PuTTY
Common Symptoms:
- Chinese, Japanese, or Korean characters appear as
???or boxes - Accented characters (Γ©, Γ±, ΓΌ) display incorrectly
- Special symbols show as random characters
- File names with non-ASCII characters look corrupted
- Man pages or documentation appears unreadable
Common Causes
1. Mismatched Character Encoding
- PuTTY uses: ISO-8859-1 (Latin-1) by default
- Most modern systems use: UTF-8
- Result: Multi-byte characters display incorrectly
2. Server Locale Issues
- Server locale not set correctly
- Terminal type not properly configured
- LANG environment variable misconfigured
3. Font Limitations
- Font doesn't include required character glyphs
- Fixed-width font missing Unicode support
- Font size affecting character rendering
Solution 1: Change PuTTY Character Set (Primary Fix)
β This fixes 90% of garbled character issues!
Steps:
- Open PuTTY Configuration
- Launch putty.exe
- Load your saved session (if applicable)
- Navigate to Translation Settings:
- In the left panel: Window β Translation
- Change Character Set:
- Find "Remote character set" dropdown
- Change from "ISO-8859-1:1998 (Latin-1, West Europe)" to:
- "UTF-8" β Select this
- Save Your Session:
- Go back to Session category
- Click "Save"
- Connect and Test:
- Click "Open"
- Characters should now display correctly
Solution 2: Adjust Server Locale
Check Current Locale
# Check current locale settings
$ locale
# You should see UTF-8 in the output
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8Fix Locale on Ubuntu/Debian
# Generate UTF-8 locales
$ sudo locale-gen en_US.UTF-8
# Update locale
$ sudo update-locale LANG=en_US.UTF-8
# For Chinese (Simplified)
$ sudo locale-gen zh_CN.UTF-8
# For Chinese (Traditional)
$ sudo locale-gen zh_TW.UTF-8
# Apply changes (logout and login, or run)
$ source /etc/default/localeFix Locale on CentOS/RHEL
# Set system locale
$ sudo localectl set-locale LANG=en_US.UTF-8
# Verify
$ localectl statusTemporary Fix (Current Session Only)
# Set for current session
$ export LANG=en_US.UTF-8
$ export LC_ALL=en_US.UTF-8
# Add to ~/.bashrc or ~/.zshrc for persistence
$ echo 'export LANG=en_US.UTF-8' >> ~/.bashrc
$ echo 'export LC_ALL=en_US.UTF-8' >> ~/.bashrcSolution 3: Change PuTTY Font
Recommended Fonts for Unicode:
- Navigate to Appearance:
- In PuTTY config: Window β Appearance
- Click "Change" for Font:
- Try these Unicode-capable fonts:
| Font Name | Best For |
|---|---|
| Consolas | General use, good Unicode support |
| Lucida Console | Wider character support |
| DejaVu Sans Mono | Excellent Unicode coverage |
| Cascadia Code | Modern, comprehensive Unicode |
| Source Code Pro | Clean, wide language support |
- Select a font and click OK
- Save your session
Solution 4: Install Language Support
For Chinese Characters
# Ubuntu/Debian
$ sudo apt-get install language-pack-zh-hans
$ sudo apt-get install fonts-wqy-microhei fonts-wqy-zenhei
# CentOS/RHEL
$ sudo yum install glibc-langpack-zh
$ sudo yum groupinstall "Chinese Support"For Japanese Characters
# Ubuntu/Debian
$ sudo apt-get install language-pack-ja
$ sudo apt-get install fonts-ipafont fonts-ipaexfontFor Korean Characters
# Ubuntu/Debian
$ sudo apt-get install language-pack-ko
$ sudo apt-get install fonts-nanum fonts-nanum-codingExample Fix Walkthrough
Scenario: Chinese File Names Display as ????
Step 1: PuTTY Configuration
- Window β Translation β Remote character set: UTF-8
- Window β Appearance β Change font to: Consolas or Lucida Console
- Save session
Step 2: Server Configuration
# SSH into server
$ ssh user@server
# Check current locale
$ locale
# If not UTF-8, fix it:
$ sudo locale-gen zh_CN.UTF-8
$ export LANG=zh_CN.UTF-8
$ export LC_ALL=zh_CN.UTF-8
# Add to ~/.bashrc for permanence
$ echo 'export LANG=zh_CN.UTF-8' >> ~/.bashrcStep 3: Test
# Create test file with Chinese name
$ touch ζ΅θ―ζδ»Ά.txt
# List files
$ ls -la
# Should display correctly now!Troubleshooting
Still Showing Boxes or Question Marks
Try this checklist:
- β PuTTY character set is UTF-8
- β Server locale is UTF-8 (
localecommand) - β Font supports the characters (try DejaVu Sans Mono)
- β Reconnect after changing settings
- β Language packs installed on server
Characters Correct in vim but Wrong in Terminal
Solution:
- vim may have its own encoding settings
- Check
:set encodingin vim - Add to
~/.vimrc:set encoding=utf-8 - Also add:
set fileencoding=utf-8
Some Characters Display, Others Don't
Cause: Font doesn't have glyphs for all Unicode characters
Solution:
- Install a comprehensive Unicode font on Windows
- Try DejaVu Sans Mono (most comprehensive)
- Or use Windows Terminal instead of PuTTY for better Unicode support
Man Pages Still Garbled
# Man pages use specific encoding
# Set environment variable
$ export LESSCHARSET=utf-8
# Add to ~/.bashrc
$ echo 'export LESSCHARSET=utf-8' >> ~/.bashrc
# Test
$ man lsFinal Checklist
Configuration Checklist:
- β PuTTY β Window β Translation: UTF-8
- β PuTTY β Window β Appearance: Unicode font (Consolas, DejaVu)
- β Server:
localeshows UTF-8 - β Server:
echo $LANGshows .UTF-8 - β Server: Language packs installed
- β Shell config (~/.bashrc): LANG and LC_ALL set to UTF-8
- β Reconnect after all changes
Prevention Tips
- Always use UTF-8: It's the universal standard
- Set default PuTTY session: Configure "Default Settings" with UTF-8
- Server templates: Include locale settings in server provisioning scripts
- Document font requirements: Note which fonts work for your languages
- Test with sample text: Keep test files with various characters
Alternative Solutions
Use Modern SSH Clients
Consider these alternatives with better Unicode support:
- Windows Terminal: Native UTF-8 support, modern UI
- MobaXterm: Excellent Unicode handling, X11 support
- Termius: Cross-platform, cloud sync
- WSL2 + Terminal: Full Linux environment on Windows