Sublime Forum

Bug: Merge conflict view breaks non-UTF encoding with working-tree-encoding

#1

Description:
I have a repository with a .gitattributes file that specifies working-tree-encoding=cp866 .

When a merge conflict occurs:

  • In the Summary view, all Cyrillic lines are incorrectly shown as changes from unreadable characters to proper Cyrillic (as if the file was re-encoded).

  • When pressing the Resolve button (3-pane conflict resolution UI), Cyrillic text is displayed correctly (no encoding issues).

  • When running git mergetool -t smerge , the 3-pane conflict resolution UI displays all Cyrillic text as garbled characters.

Expected behavior:
Sublime Merge should respect working-tree-encoding and display Cyrillic correctly in all views, including both Summary and when launched via git mergetool -t smerge .

Environment:

  • Sublime Merge version: 2112
  • OS: both Windows and Linux
  • Git version: 2.51.0 / 2.46.2

Steps to reproduce:

#!/bin/bash
rm -rf test-repo
mkdir test-repo
cd test-repo
git init --initial-branch=main

# Set working-tree-encoding in .gitattributes
echo "*.txt working-tree-encoding=cp866" > .gitattributes
git add .gitattributes
git commit -m "Add .gitattributes with cp866"

# Initial file (mixed Cyrillic + Latin), saved in cp866
cat > file.txt <<EOF
Привет мир
Hello world
Тест конфликта
Test conflict
Строка 5
Строка 6
Строка 7
EOF
iconv -f utf-8 -t cp866 file.txt -o file.txt
git add file.txt
git commit -m "Initial commit with mixed Cyrillic/Latin text"

# Branch1 changes
git checkout -b branch1
cat > file.txt <<EOF
Привет мир
Hello world
Тест конфликта
Test conflict 1
Строка 5
Строка 6
Строка 7
EOF
iconv -f utf-8 -t cp866 file.txt -o file.txt
git commit -am "Changes in branch1"

# Main branch changes
git checkout main
cat > file.txt <<EOF
Привет мир
Hello world
Тест конфликта
Test conflict 2
Строка 5
Строка 6
Строка 7
EOF
iconv -f utf-8 -t cp866 file.txt -o file.txt
git commit -am "Changes in main"

# Create merge conflict
git merge branch1 || true

echo
echo "=== Repository ready ==="
echo "Open 'test-repo' in Sublime Merge:"
echo "- Summary tab: Cyrillic appears as encoding changes"
echo "- Resolve button (3-pane conflict resolution UI): Cyrillic looks correct !"
echo "- git mergetool -t smerge: Cyrillic is broken"
0 Likes