Chinese characters in code are garbled in recent Codex versions
What version of Codex is running?
codex-cli 0.42.0
Which model were you using?
gpt-5-codex high
What platform is your computer?
Windows 11 Home 64-bit
What steps can reproduce the bug?
When generating code that contains Chinese characters (for example, comments or strings), Codex outputs garbled text instead of proper Chinese.
Steps to reproduce:
- Ask Codex to generate a simple program with Chinese comments or string literals.
Example prompt: "Write a Python program that prints '你好世界' and add a Chinese comment." - The output code will show corrupted characters instead of correct Chinese.
Expected behavior: Codex should output proper UTF-8 encoded Chinese characters in the generated code.
Actual behavior: Codex outputs garbled/unreadable characters (mojibake) instead of Chinese.
What is the expected behavior?
Codex should correctly generate and display Chinese characters (UTF-8 encoding) inside code, including comments and string literals. For example, when generating:
print("首頁")
It should show exactly as above.
What do you see instead?
Instead of showing correct Chinese characters, Codex outputs corrupted/garbled text (mojibake). For example, the above code becomes something like:
print("����'")
Additional information
- This issue started happening in recent versions of Codex. Older versions could display Chinese correctly.
- The problem occurs consistently on Windows 11 (64-bit) environment.
- The bug makes it difficult for developers who use Chinese (or other non-Latin scripts) to generate code with comments or string literals in their own language.
- It seems to be an encoding regression, possibly related to UTF-8 handling.
The same happens with Portuguese; Codex seems to get confused when handling UTF-8 characters.
Example:
// Critérios para considerar
Part of the output:
• Ran powershell.exe -NoProfile -Command '$line = (Get-Content '"'Expression/
│ ExpressionService.cs' -Encoding UTF8)[21];
│ "'$bytes = [System.Text.Encoding]::GetEncoding(1252).GetBytes($line);
• I’m weighing how to handle accented characters since conversion isn't perfect, but I’ll prioritize
functionality over comment accuracy for now. I’m focusing on updating IExpressionRepository and related
repository implementations to align new method signatures and parameter conversions, then compiling to check
└ 301: dbTran.Commit();
320: public List<ExpressionDto> QueryExpressionsFromQueue(int count)
│ $lines.AddRange([IO.File]::ReadAllLines($path));$lines.RemoveRange(305,7);Set-Content $path $lines
• Ran powershell.exe -NoProfile -Command "(Get-Content 'TextHub/Expression/
│ ExpressionService.cs' -Raw) -replace 'return ret;\\\\r\\\\n \\}', \"return
│ ret;"'`r`n }" | Set-Content '"'Expression/ExpressionService.cs' -Encoding
│ … +1 lines
322: {
… +7 lines
335: /// <summary>
336: /// Quando um resultado ǟ�� encontrado, atuali
80: queue[expq.ExpressionQueueId] = expq;
This seems like it's fixed in 0.47. I ran the exact prompt ("Write a Python program that prints '你好世界' and add a Chinese comment.") and looked at the output in codex and in the file
# 输出问候语
print("你好世界")
Can you please retest and update this if you're still seeing this problem?