gemini-cli - 💡(How to fix) Fix Encoding issue (Mojibake) when reading files containing Chinese characters on Windows

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Example of Error Output:

RAW_BUFFERClick to expand / collapse

What happened?

In a Windows environment (win32), the agent fails to correctly read and process files containing Chinese characters (UTF-8/Big5). When using tools like read_file or run_shell_command (e.g., type or Get-Content), the output returned to the agent is garbled (Mojibake), making it impossible for the agent to understand the documentation or source code. This severely breaks the "Research" phase of the development lifecycle.

Steps to Reproduce:

  1. Create a Markdown or source file with Chinese content.
  2. Use the agent to read the file using read_file or run_shell_command.
  3. Observe the output in the session history.

Environment:

  • OS: Windows (win32)
  • Shell: PowerShell / CMD
  • Character Set: Potential mismatch between file encoding (UTF-8) and shell output encoding.

Example of Error Output: Output: # MPB.MTNET.MA ??賹??? (Living SPEC) - v6 ?鞈f秘??軋斯踝脤? (Expected readable Chinese characters but got replacement characters and gibberish.)

[ACTION REQUIRED] 📎 PLEASE ATTACH THE EXPORTED CHAT HISTORY JSON FILE TO THIS ISSUE IF YOU FEEL COMFORTABLE SHARING IT.

What did you expect to happen?

  1. The output should display readable Chinese characters (e.g., # Project Survival Guide) without any garbled text.
  2. The agent should be able to parse the content accurately and base its strategy on the actual text instead of nonsensical characters.
  3. The tool should automatically detect and handle file encodings (e.g., UTF-8) correctly within the Windows environment and shell output.

Client information

│ CLI Version 0.42.0 │ │ Git Commit 68e2196d5 │ │ Model gemini-3-flash-preview │ │ Sandbox no sandbox │ │ OS win32 │ │ Auth Method Signed in with Google ([email protected]) │ │ Tier Gemini Code Assist for individuals

Login information

No response

Anything else we need to know?

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - 💡(How to fix) Fix Encoding issue (Mojibake) when reading files containing Chinese characters on Windows