How to configure the default encoding (utf-8) in Codex/VSCODE
Open 💬 5 comments Opened Dec 19, 2025 by santanaigorsg
What version of the VS Code extension are you using?
0.4.53
What subscription do you have?
Plus
Which IDE are you using?
VS Code
What platform is your computer?
Windows 11
What issue are you seeing?
Hello, I use VS Code with the Codex extension and my language is PT-BR UTF-8 WITHOUT BOM. The problem is that whenever the Codex agent encodes something, it converts it to UTF-8-WITCH BOM, and this always breaks my code. How do I configure the Codex extension in VS Code to use UTF-8 WITHOUT BOM? Would it be directly in config.toml?
What steps can reproduce the bug?
Whenever I send a command to the agent to encode it
What is the expected behavior?
_No response_
Additional information
_No response_
5 Comments
I’m experiencing same issue with the OpenAI Codex VSCode plugin. Whenever I modify files through the plugin, it automatically changes the file encoding to UTF-8 with BOM, which causes problems in my Laravel/Vue project. In addition, it alters accented characters (such as á, é, í, ó, ú, ñ) and replaces them with strange symbols, as shown in the attached image. This affects text readability and introduces unwanted encoding inconsistencies across the project files.
<img width="336" height="74" alt="Image" src="https://github.com/user-attachments/assets/c70f0136-546c-439e-a119-83ef3a45ec1a" />
It is causing me headache too. Edit my PHP files and add BOM.
You may consider adding an AGENTs.md file to explicitly specify that files should be opened and saved using UTF-8 encoding, which can help ensure the default encoding behavior in Codex/VSCode.
AGENTs.md is a project-level guidance file used to give instructions to AI coding agents (like Codex) about how to work in the repository—things like coding conventions, file handling rules, encoding standards, and other workflow preferences. It helps ensure consistent behavior when the agent reads or modifies files.
Currently it is not supported.
Workarounds
This restores file encodings after Codex changed them.
AGENTS.md
One way is to use an
AGENTS.mdfile and a encoding-conversion script that fixes source code to use the correct encoding.Git Hooks
Another way is to use a git hook that automatically executes an encoding-fix script:
or if you want to version the script:
then in the
pre-commitfile add the instructions on how to run the script:Git Config
You can specify the file encoding in git and git will automatically fix it for you
in
.gitconfigI think codex should do the following: