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

Re: [PATCH] ignores: handle non UTF-8 exclude files

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jan 6, 2026, 23:22 UTC
Message-ID
<aV2ZS1lvLivi8xRH@fruit.crustytoothpaste.net>
In-Reply-To
<CALH9GrYOjb92gjrtdjwapFH9L73XGg1Kan8uz1aVLpSXNURi+Q@mail.gmail.com>
On 2026-01-06 at 20:45:56, Matthieu Beauchamp wrote:
Show 9 quoted lines
> On Sun, Jan 4, 2026 at 2:40 PM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> > Ah, yes, here's the problem.  UTF-16LE is used on Windows, and on
> > Windows, Git stores pathnames as if they were converted into UTF-8, so
> > you do need to write the filenames in UTF-8 in the ignore file.
> >
> 
> Yes, the conversion from UTF16-LE to UTF-8 would need to be platform
> specific.

We typically don't want platform-specific behaviour in Git. Many Git contributors do not work on Windows but we want things to work as much as possible identically across all platforms because it makes development easier, as well as making it easier for users to reason about the project. I, for one, don't have a Windows system (nor do I want one) but I do want my Git code to just work there.

As an example, we still use a POSIX shell in aliases and other settings on Windows despite the fact that PowerShell is built into Windows because it means that aliases and similar functionality just work correctly regardless of platform and it allows users to write a config file that works everywhere.

Instead of trying to force Git to gracefully handle UTF-16 in its config files, my strong recommendation is to adjust your PowerShell scripts to use UTF-8 instead[0] or use a POSIX shell. I'll note that Microsoft's new Edit text editor[1] defaults to UTF-8 (and, except on Windows, LF line endings), so I know that Microsoft understands that UTF-8 is the proper encoding to use on the Internet today.

[0] https://stackoverflow.com/questions/5596982/using-powershell-to-write-a-file-in-utf-8-without-the-bom [1] Available at https://github.com/microsoft/edit and apparently shipped with Windows. I will say that I was impressed at its functionality for a 231 KiB binary footprint.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Matthieu BeauchampNext: Collin Funk
Message 9 of 13 in “ignores: handle non UTF-8 exclude files”
  1. ignores: handle non UTF-8 exclude filesMatthieu Beauchamp-Boulay via GitGitGadget, Jan 3, 2026
  2. Junio C HamanoJan 4, 2026
  3. Matthieu BeauchampJan 6, 2026
  4. Torsten BögershausenJan 4, 2026
  5. Matthieu BeauchampJan 6, 2026
  6. Phillip WoodJan 7, 2026
  7. brian m. carlsonJan 4, 2026
  8. Matthieu BeauchampJan 6, 2026
  9. brian m. carlsonJan 6, 2026
  10. Collin FunkJan 7, 2026
  11. Phillip WoodJan 7, 2026
  12. brian m. carlsonJan 7, 2026
  13. Collin FunkJan 8, 2026

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.