If you run Gemini CLI on Windows and the terminal spits out garbled Chinese (or any CJK), question marks, or little boxes, it's almost never a bug in Gemini CLI itself. The real cause is an encoding mismatch: the Windows CMD / PowerShell default is often Big5 (code page cp950) for a Traditional-Chinese system, while Gemini CLI (a Node app) outputs UTF-8. When the two don't match, you get mojibake.

This post walks the fix in order — terminal → font → system → file encoding. Try the first steps; they solve most cases. Leave the system-wide setting for last, as a last resort.

First, a free sanity step: update Gemini CLI to the latest version to rule out the binary itself. But keep in mind the garbled text on Windows is usually not caused by the version — it's the terminal encoding, so you'll likely still need the settings below.

1. CMD: switch to UTF-8 (chcp 65001)

If you're on Command Prompt (CMD), run this before Gemini CLI:

chcp 65001 

This switches the current window to UTF-8 (code page 65001). In many cases, this single line fixes it. Note it only affects the current window.

2. PowerShell: use PowerShell 7 and pin the encoding

If you're on PowerShell:

  • Use PowerShell 7 (pwsh). Its UTF-8 support is much better than the old Windows PowerShell 5.1.
  • Pin the output encoding in your $PROFILE so it's applied automatically every time. Add this to $PROFILE:
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # If you also pipe ( | ) output to other programs, add: $OutputEncoding = [System.Text.Encoding]::UTF8 

If $PROFILE doesn't exist yet, create it first with New-Item -Path $PROFILE -Type File -Force, then edit it.

3. Seeing boxes instead of garble? It's the font

If, after switching to UTF-8, the Chinese is no longer garbled but shows as empty boxes (□), the encoding is right but your terminal font lacks those glyphs. Switch the terminal font to a monospace font with CJK coverage — for example the free Sarasa Mono (更紗黑體).

4. Last resort: set the whole system to UTF-8 (has risks)

If nothing above works, you can change a system setting — but it's system-wide, flagged Beta, so understand the risk first:

  1. Open Control Panel → Region.
  2. Go to the Administrative tab → Change system locale.
  3. Check "Beta: Use Unicode UTF-8 for worldwide language support".
  4. Reboot.

(On newer Windows 11 you may reach it via Settings → Time & language → Language & region → Administrative language settings; the exact menu names vary by version.)

It cures a lot of encoding problems, but some legacy apps that only support the old code page (Big5) may break. So try the CMD / PowerShell settings first, and only touch this if you've exhausted them and accept the risk.

5. Scripts still garbled? Check the file's encoding

If the terminal is fixed but your own script or data file still shows garble, the problem is usually the file's encoding, not the terminal:

  • Save scripts and data files as UTF-8.
  • PowerShell 7 reads UTF-8 without BOM fine. But if a Chinese-containing .ps1 has to run under the old Windows PowerShell 5.1, a missing BOM makes it interpret the bytes as the system ANSI code page (cp950 for Traditional Chinese) and break — in that case save it as UTF-8 with BOM.

Wrap-up

Garbled Chinese in Gemini CLI on Windows boils down to the terminal not being UTF-8. Order of fixes:

  1. Update Gemini CLI (rule out the version)
  2. CMD: chcp 65001; PowerShell: use 7, pin UTF-8 in $PROFILE
  3. Boxes → switch to a CJK monospace font (e.g. Sarasa Mono)
  4. Still stuck and you accept the risk → the system Beta UTF-8 option (last resort)
  5. Scripts still garbled → check the file's own encoding (save UTF-8, add BOM if it must run under PowerShell 5.1)

Start from step 2; it clears up the vast majority of cases.

I originally wrote a Traditional Chinese version on my site: Gemini CLI 中文亂碼怎麼解?Windows 終端機 UTF-8 設定全攻略.