You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Log() and Commit() return garbled non-ASCII text, and Commit() writes mojibake, on hosts that set i18n.logOutputEncoding / i18n.commitEncoding #246
The library decodes git's standard output as UTF-8, but two verbs never pin the encoding git uses. That leaves them exposed to host configuration, which is the same class of problem the existing "pin host config" design points already guard against, for example --no-show-signature and --no-follow in GitLogBuilder.
Reading:GitLogBuilder.AppendVerbArguments (GitIntegration/Builders/GitLogBuilder.cs, about lines 158-173) emits log --no-show-signature --no-follow -z --format=… without --encoding=UTF-8. When a host sets i18n.logOutputEncoding, or only i18n.commitEncoding (which logOutputEncoding defaults to), git re-encodes author names and messages into that charset. Commit() reuses this vector for its log -1 read-back (GitCommitBuilder.cs about lines 257-261), so it is affected too.
Writing:GitCommitBuilder (GitIntegration/Builders/GitCommitBuilder.cs, about lines 115-136) runs commit without -c i18n.commitEncoding=UTF-8. git writes the argv bytes, which are UTF-8 from .NET, under whatever encoding header the host config says.
Failure scenario (reproduced with git 2.43)
Create a UTF-8 commit with author José and message café.
git -c i18n.logOutputEncoding=ISO-8859-1 log -1 --format=%an|%B emits the single byte 0xE9 for each é.
Decoded as UTF-8, that byte becomes U+FFFD, so Log() reports Jos� / caf�. Commit()'s returned GitCommit is garbled the same way.
With --encoding=UTF-8 git emits the correct bytes C3 A9.
git -c i18n.commitEncoding=ISO-8859-1 commit -m 'naïve' stores UTF-8 bytes under an encoding ISO-8859-1 header.
Every standard reader, including GitHub, then shows naïve. The library has permanently written mojibake into history.
Suggested fix
Add --encoding=UTF-8 to GitLogBuilder's argument vector. This also fixes Commit()'s read-back.
Add -c i18n.commitEncoding=UTF-8 before the commit verb in GitCommitBuilder, the same way GitPatchBuilder places its -c pin ahead of the verb.
Acceptance criteria
Argument-vector tests assert both pins.
An integration test with -c i18n.logOutputEncoding=ISO-8859-1 (or the repo config set to that value) and a non-ASCII author and subject round-trips through Log() and Commit() unchanged.
An integration test with i18n.commitEncoding=ISO-8859-1 confirms the stored commit has no non-UTF-8 encoding header, or that it reads back correctly with plain git log.
Priority: Medium. It only bites on hosts that set i18n.logOutputEncoding or i18n.commitEncoding, but on those hosts Commit() permanently writes mojibake into history, which cannot be undone without rewriting history. The fix is two argument pins: --encoding=UTF-8 on log, and -c i18n.commitEncoding=UTF-8 on commit.
Area / suggested assignment: GitIntegration GitLogBuilder and GitCommitBuilder argument vectors.
Activity
matt-edmondson commentedon Oct 18, 2026
Triage
i18n.logOutputEncodingori18n.commitEncoding, but on those hostsCommit()permanently writes mojibake into history, which cannot be undone without rewriting history. The fix is two argument pins:--encoding=UTF-8on log, and-c i18n.commitEncoding=UTF-8on commit.GitLogBuilderandGitCommitBuilderargument vectors.--after revisions #168 (PR Close revision operands with -- in Log, RevList, Diff and Patch [patch] #223). No duplicate found.Generated by Claude Code