git/list[1] front-page[2] threads[3] people[4] search[5] about
 

help request: unable to merge UTF-16-LE "text" file

From
KLKevin Long <kevinlong206@gmail.com>
Date
Apr 19, 2022, 19:36 UTC
Message-ID
<CAJCZ4U-9KYGK0jwnL1GyOYW-CMjV_Eo--g85CbexsV=aQnn7aw@mail.gmail.com>
Greetings,
I've been struggling to merge branches because of a UTF-16-LE (with BOM?) file.
Windows 11 / git version 2.35.3.windows.1

The problem file is a .sln file (Visual Studio "solution"). Edited in both branches. It is a "text" file, but is encoded as such:

FacilityMaster.sln: Unicode text, UTF-16, little-endian text, with CRLF line terminators

I have tried several "working-tree-encoding" settings in .gitattributes in my local working directory, to no avail yet:

*.sln working-tree-encoding=UTF-16-LE eol=CRLF, results in: error: failed to encode 'FacilityMaster.sln' from UTF-16-LE to UTF-8 warning: Cannot merge binary files: FacilityMaster.sln (HEAD vs. master)

*.sln working-tree-encoding=UTF-16 eol=CRLF, results in: warning: Cannot merge binary files: FacilityMaster.sln (HEAD vs. master)

*.sln working-tree-encoding=UTF-16-LE-BOM eol=CRLF error: failed to encode 'FacilityMaster.sln' from UTF-16-LE-BOM to UTF-8 warning: Cannot merge binary files: FacilityMaster.sln (HEAD vs. master)

Hoping for some suggestions. I've also tried to save the file as UTF-8 in both branches, commit, then merge, but still that did not work. I just want to merge it like a normal source code file.

Thank you,
Kevin Long
Next: brian m. carlson
Message 1 of 9 in “help request: unable to merge UTF-16-LE "text" file”
  1. Kevin LongApr 19, 2022
  2. brian m. carlsonApr 19, 2022
  3. Erik Cervin EdinApr 20, 2022
  4. Kevin LongApr 20, 2022
  5. Junio C HamanoApr 20, 2022
  6. Erik Cervin EdinApr 20, 2022
  7. Erik Cervin EdinApr 20, 2022
  8. Chris TorekApr 24, 2022
  9. Plato KiorpelidisApr 22, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.