Codex App terminal: git log shows Japanese UTF-8 commit messages as <E6><...> when locale env vars are empty

Open 💬 2 comments Opened Jun 8, 2026 by inoway46

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?

  1. Open the Codex App terminal.
  1. In a Git repository with Japanese UTF-8 commit messages, run:
git log
  1. Japanese text is displayed as byte escapes such as <E6><97><A5>....
  1. Run:
git --no-pager log -1
  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.

View original on GitHub ↗

2 Comments

inoway46 · 2 months ago

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:

$ locale
LANG=""
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
$ env | grep -E '^(LANG|LC_|LESSCHARSET|PAGER|GIT_PAGER|TERM)='
TERM=xterm-256color

Regular macOS Terminal.app:

$ locale
LANG="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_CTYPE="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_ALL=
$ env | grep -E '^(LANG|LC_|LESSCHARSET|PAGER|GIT_PAGER|TERM)='
TERM=xterm-256color
LANG=ja_JP.UTF-8

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:

LESSCHARSET=utf-8 git log

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:

less determines UTF-8 handling from the locale or LESSCHARSET.

The less(1) man page says that if LESSCHARSET / LESSCHARDEF are not set, less uses UTF-8 when LC_ALL, LC_CTYPE, or LANG contains UTF-8 / utf-8. The Less FAQ also says that UTF-8 text should be handled by setting a UTF-8 locale or LESSCHARSET=utf-8.

inoway46 · 2 months ago

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 $LANG based on the operating system locale with UTF-8 encoding when $LANG is not properly configured.

This might be a useful reference for how an integrated terminal can handle missing or non-UTF-8 locale settings.