git_futils_find_global_file contains two calls to getenv, which will return strings encoded via the current code page. But we assume that these strings are UTF-8, which then causes other file-related APIs to fail.
I think we need to call either _wgetenv or GetEnvironmentVariableW, both of which return a UTF-16 string, and then convert it to UTF-8. I believe this matches how we deal with similar issues elsewhere.
Fix in progress
Fixing this was pretty easy. Writing the tests - not so much.
Perhaps spoke too soon. I'm still having some issues.
I believe this issue is now solved. We could probably go even further (there are suggestions about using SHGetFolderPath instead of examining environment variables as we do today), but I think the immediate problem has been taken care of.