Codex App terminal: git log shows Japanese UTF-8 commit messages as <E6><...> when locale env vars are empty
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.602.40724
What subscription do you have?
Pro
What platform is your computer?
Darwin 24.6.0 arm64 arm
What issue are you seeing?
In the Codex App terminal, git log displays Japanese UTF-8 commit messages as byte escapes like <E6><97><A5>....
Example:
ABC-1234 <E6><97><A5><E6><9C><AC><E8><AA><9E><E3><81><AE><E3><82><B3><E3><83><9F><E3><83><83><E3><83><88><E3><83><A1><E3><83><83><E3><82><BB><E3><83><BC><E3><82><B8>
However, the commit message itself is valid UTF-8. Running git --no-pager log -1 displays the Japanese text correctly:
ABC-1234 日本語のコミットメッセージ
This seems to happen only when Git uses a pager. The terminal itself can render Japanese correctly when bypassing the pager with git --no-pager log.
What steps can reproduce the bug?
- Open the Codex App terminal.
- In a Git repository with Japanese UTF-8 commit messages, run:
git log
- Japanese text is displayed as byte escapes such as
<E6><97><A5>....
- Run:
git --no-pager log -1
- Japanese text is displayed correctly.
What is the expected behavior?
The Codex App terminal should initialize a UTF-8 locale environment, or otherwise ensure that pagers such as less handle UTF-8 output correctly.
For example, git log should display Japanese UTF-8 commit messages correctly without requiring users to manually set LESSCHARSET=utf-8.
Additional information
Environment variables inside Codex App terminal
I checked the locale and pager-related environment variables:
echo "LANG=$LANG"
echo "LC_ALL=$LC_ALL"
echo "LC_CTYPE=$LC_CTYPE"
echo "LESSCHARSET=$LESSCHARSET"
echo "PAGER=$PAGER"
echo "GIT_PAGER=$GIT_PAGER"
Output:
LANG=
LC_ALL=
LC_CTYPE=
LESSCHARSET=
PAGER=
GIT_PAGER=
Workaround
This fixes the display:
LESSCHARSET=utf-8 git log
or globally for Git:
git config --global core.pager 'LESSCHARSET=utf-8 less -R'
Notes
This looks different from general mojibake issues because the terminal can render Japanese correctly. The problem appears when git log invokes less while locale-related environment variables such as LANG, LC_ALL, and LC_CTYPE are empty.
2 Comments
Additional data point:
I compared the locale-related environment variables between the Codex App terminal and the regular macOS Terminal.app on the same machine/user.
Codex App terminal:
Regular macOS Terminal.app:
So this does not appear to be caused by the repository, Git commit encoding, or my global Git configuration.
The same machine/user has a UTF-8 locale in Terminal.app, but the Codex App terminal starts with LANG="" and LC_CTYPE=C. Since less determines UTF-8 handling from locale variables such as LC_ALL, LC_CTYPE, LANG, or from LESSCHARSET, this explains why git log through the pager shows UTF-8 bytes as <E6>... only in the Codex App terminal.
The workaround still works:
Based on this comparison, this looks app-specific: the Codex App terminal appears not to inherit or initialize the user's UTF-8 locale environment.
Reference:
lessdetermines UTF-8 handling from the locale orLESSCHARSET.The
less(1)man page says that ifLESSCHARSET/LESSCHARDEFare not set,lessuses UTF-8 whenLC_ALL,LC_CTYPE, orLANGcontainsUTF-8/utf-8. The Less FAQ also says that UTF-8 text should be handled by setting a UTF-8 locale orLESSCHARSET=utf-8.Possible related behavior / implementation reference:
Visual Studio Code appears to handle a similar case in its integrated terminal via
terminal.integrated.detectLocale:https://code.visualstudio.com/docs/terminal/advanced#_interaction-with-lang
The documentation says Visual Studio Code can set
$LANGbased on the operating system locale with UTF-8 encoding when$LANGis not properly configured.This might be a useful reference for how an integrated terminal can handle missing or non-UTF-8 locale settings.