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.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗