Repository navigation
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.140.0 / main
- OS Version: Windows / macOS / Linux
In extensions/git/src/git.ts, Repository.getStashes() runs git stash list without forcing the output encoding to UTF-8. If a repository or global gitconfig sets i18n.logOutputEncoding (or i18n.commitEncoding), non-ASCII stash messages appear as corrupted characters (Mojibake) in the Source Control Stashes view and related QuickPicks.
This is a follow-up to #331086 / PR #331087, which added -c i18n.logOutputEncoding=UTF-8 to log, logFile, blame2, getCommit, and showChanges, but missed getStashes.
Steps to Reproduce:
- Initialize a repository with non-UTF-8 encoding configured:
git init test-repo cd test-repo git commit --allow-empty -m "initial" echo "sample" > file.txt git add file.txt git config i18n.commitEncoding EUC-JP git config i18n.logOutputEncoding EUC-JP
- Create a stash with a non-ASCII message (e.g., EUC-JP text):
git stash push -m "$(printf '\xa5\xc6\xa5\xb9\xa5\xc8 stash')" - Open the folder in VS Code with extensions disabled (
code --disable-extensions .). - Inspect the stash in the Source Control panel or via
Git: Pop Stash....
Expected Behavior:
The stash message is decoded and displayed as On master: テスト stash.
Actual Behavior:
The stash message displays as On master: ƥ stash.
Direct CLI comparison:
# Current git.ts behavior (garbled output)
$ git stash list
stash@{0}: On master: ƥ stash
# Expected git.ts behavior (with -c i18n.logOutputEncoding=UTF-8)
$ git -c i18n.logOutputEncoding=UTF-8 stash list
stash@{0}: On master: テスト stashCause:
In extensions/git/src/git.ts:3022:
async getStashes(): Promise<Stash[]> {
const result = await this.exec(['stash', 'list', `--format=${STASH_FORMAT}`, '-z']);
return parseGitStashes(result.stdout.trim());
}Because this.exec() decodes stdout using bufferResult.stdout.toString('utf8') (line 657), git stash list needs -c i18n.logOutputEncoding=UTF-8 prepended to ensure Git converts the commit message to UTF-8 before writing to stdout:
const result = await this.exec(['-c', 'i18n.logOutputEncoding=UTF-8', 'stash', 'list', `--format=${STASH_FORMAT}`, '-z']);
Activity
lszomoru commentedon Nov 23, 2026
I can reproduce this in VS Code Insiders 1.148.0 on Linux (git 2.43.0):
git config i18n.logOutputEncoding EUC-JP.git stash push -m "テスト stash".The picker shows
#0: �ƥ��� stashinstead of#0: テスト stash. The Stashes view shows the same text.getStashes()readsgit stash listas UTF-8 but, unlike log, blame and show (#331087), it doesn't ask git for UTF-8 output.A note on the exact steps above, where the message bytes themselves are EUC-JP (
i18n.commitEncoding EUC-JPplus a raw EUC-JP message): the stash list shows the stash's reflog subject (%gs), and git doesn't re-encode reflog subjects. Evengit -c i18n.logOutputEncoding=UTF-8 stash list --format=%gsprints those bytes unchanged, so the override fixes UTF-8 messages read with a non-UTF-8logOutputEncoding, but not a message stored as EUC-JP.339256-before-insiders.mp4
🤖 Authored with GitHub Copilot on behalf of Ladislau Szomoru (@lszomoru).
Git - read stash list with UTF-8 log output encoding (microsoft#349858)