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

Re: Weird filename encoding issue

From
RRRobin Rosenberg <robin.rosenberg@gmail.com>
Date
Oct 18, 2008, 02:58 UTC
Message-ID
<200810180458.53853.robin.rosenberg@gmail.com>
In-Reply-To
<48F852FC.2070506@viscovery.net>
fredagen den 17 oktober 2008 10.55.24 skrev Johannes Sixt:
Show 32 quoted lines
> 
> Alexander Gladysh schrieb:
> > 3. Clone repo to OS X machine and see the weird behaviour. Git status
> > can't decide how file should be named, "%CA%EE%EF%E8%FF.txt" or
> > "\312\356\357\350\377.txt".
> 
> It's not 'git status' that cannot decide how to name the file. It's OS X.
> 
> > $ git status
> > # On branch master
> > # Untracked files:
> > #   (use "git add <file>..." to include in what will be committed)
> > #
> > #	%CA%EE%EF%E8%FF.txt
> > nothing added to commit but untracked files present (use "git add" to track)
> > $ ls
> > %CA%EE%EF%E8%FF.txt
> 
> git asked OS X:
> 
>    Does the file "\312\356\357\350\377.txt" exist?
> 
> and OS X said: "Yes". Because otherwise, you would have seen the file
> listed as "deleted:" in the 'git status' call above.
> 
> But then git also requested a file listing from OS X in order to list the
> untracked files. And now OS X returned the name "%CA%EE%EF%E8%FF.txt". How
> could you expect git to tell that this is the same file when OS X cannot
> decide how to name it?
> 
> The solution: Do not use file names with some local (let alone Windows
> specific) encoding if you have to use the files on OS X, too.
That seems to be OS-X's way of saying the is a string of garbage, lets handle it as such.

Git (or msys) under windows is somewhat stupid here as it involves the eight-bit locale despite running in a unicode OS. To get UTF-8 on XP you can set the codepage to UTF-8 (called 65001 in windows). That might still cause problems with OS-X for some chararacters as it wants to "decompose" the UTF-8 encoding for accented characters, which perhaps is not a problem for you.

I have no idea how well codepage 65001 plays with msys, but it would be nice it would work. I'm not sure how to switch codepage in msys, but if you set it from cmd and then start msys bash from there, I'm pretty sure it will pick it up.

-- robin
Previous: Johannes SixtNext: Peter Krefting
Message 4 of 10 in “Weird filename encoding issue”
  1. Alexander GladyshOct 17, 2008
  2. Alexander GladyshOct 17, 2008
  3. Johannes SixtOct 17, 2008
  4. Robin RosenbergOct 18, 2008
  5. Peter KreftingOct 27, 2008
  6. Alexander GladyshOct 18, 2008
  7. Robin RosenbergOct 18, 2008
  8. Johannes SixtOct 18, 2008
  9. Alexander GladyshOct 19, 2008
  10. Jakub NarebskiOct 17, 2008

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.