LibGit2Sharp: UTF-16LE Encoded CSV Files Treated as Binary in Diff — How to Ensure Text Recognition?

39 Views Asked by At

I'm currently facing an issue with LibGit2Sharp when attempting to detect changes in UTF-16LE encoded CSV files. During the diff operation for uncommitted changes, LibGit2Sharp is treating these files as binary, resulting in a diff output with "Binary files differ" and 0 lines added or removed.

Here's a snippet of the problematic diff result:

diff --git a/test.csv b/test.csv
deleted file mode 100644
index 6e31ad9..0000000
Binary files a/test.csv and /dev/null differ

I've tried using the following code to retrieve the changes:

List<Commit> commitList = new List<Commit>();
foreach (LogEntry entry in repo.Commits.QueryBy("test.csv").Take(1).ToList())
    commitList.Add(entry.Commit);

var repoDifferences = repo.Diff.Compare<Patch>(commitList[0].Tree, null);

Any insights or suggestions on resolving this issue would be greatly appreciated. Thank you!

0

There are 0 best solutions below