Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Diff for Latin1-encoded files

Christian Lindig June 4, 2012

I'm using both Latin1 and UTF8 encoded files in my projects. The browser showing diffs seems always to assume the UTF8 encoding, resulting in incorrectly showing non-ascii characters. Is there a way to tell SourceTree (or Git) about the encoding of a file?

Addendum: picking an encoding on a per-project basis would be sufficient rather than on a per-file basis. The reason I'm using Latin1 in some projects is that these are legal documents that I share with non-developers on Windows machines that seem to prefer it.

2 answers

1 accepted

1 vote
Answer accepted
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2012

Actually, I take it back, there is a way to do this. You can create a .gitattributes file for the folder/pattern and define the 'encoding' setting there. This should be picked up by SourceTree in the diffs too. http://schacon.github.com/git/gitattributes.html

1 vote
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2012

No. There's no practical reason to be using Latin1 encoding in 2012. While you can change the encoding in git, doing it on a per-file basis is very impractical. You'll save ourself far more pain just by standardising on UTF.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events