Sublime Forum

Working-tree-encoding and git diff

#1

Hi

Sublime Merge is great.

However, the diff behaves a bit different than git diff when using non-utf8 files.

Without any .gitattributes and files in windows-1252 encoding:

  • git diff shows Markers like <FC> for ü on both sides of the diff, if lines containing non-utf8 characters are changed
  • Sublime Merge shows the non-utf8 chars like they are displayed in Sublime Text if encoding is set to Windows 1252

When i add ‘*.c text working-tree-encoding=windows-1252’ to .gitattributes, and do a git add --renormalize . and a commit then the following happens in all further changes:

  • git diff shows diffs in the correct encoding, showing ü instead of <FC>
  • When the file is unstaged, Sublime merge shows a ‘gray’ (no red/green, but a stageable hunk) change on every occurence of any non-utf8 character in the file.
  • When the file is staged, Sublime merge shows only the diff of the actually changed lines.

If I stage one of those gray hunks via Sublime Merge, the following happens:

  • I thing some utf-8 version is staged??
  • All occourences of non-utf8 characters that have been gray in the diff are now red/green with a change from ü to ü.
  • The staged hunk is now gray
  • git diff shows - <FC> + ü
  • git diff --staged shows - ü + <FC>
  • But git diff only shows the origially changed line and the staged hunk, but none of the other hunks that Sublime Merge shows.

Thanks for fixing
Daniel

0 Likes

#2

Which version of Sublime Merge are you using? Build 2002 has support for encodings.

0 Likes

#3

Ah, 1119. Hm Thought it would update automatically like ST. But maybe because I am behind a proxy…

0 Likes

#4

2002 is the latest development build. 1119 is the latest stable build.

0 Likes

#5

2004 does do it differently, but still not correctly.
Would it help to create an example repo or is it reproducible by my description?

0 Likes

#6

Likely, if you can post an issue on the issue tracker on github.

0 Likes

#7

Thanks for your time and help

0 Likes