Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set-up git with utf8 filenames in EGit

Tags:

git

eclipse

egit

I have a java project with files with umlaut charachters in their names. How do I have to set-up a git repository in order it can be used with the EGit plugin of Eclipse.

I already tried with a simple

 git init
 git add *

But this turned out to be non working as you can see in this post.

I think somehow I have to tell git that it has to treat the file names as utf8.

I'm on Max OSX 10.7, but I've seen the same problem on Windows 7 Pro.

Any ideas?

like image 799
BetaRide Avatar asked Dec 05 '25 14:12

BetaRide


1 Answers

MacOS encodes characters (in filenames) in decomposed form (NFD), while everyone else uses the composed form (NFC). When adding filenames using Git the decomposed form enters the repository, since Git (except on Windows) does not recode the filenames it reads from disk.

EGit assumes the composed form is used. If you use non-ascii names on Mac, only use EGit or JGit with the repo, unless you are aware of the issues.

Git for Windows as of 1.7.10 uses UTF-8 NFC.

Composed for means that a character like "Ä" is encoded as one unicode character, while the decomposed form means it is encoded as "A" + "Add two dots above previous character".

$ touch Ä
$ echo Ä|od -tx1a
0000000    c3  84  0a                                                    
           ?  84  nl                                                    
0000003
$ ls|od -tx1a
0000000    41  cc  88  0a                                                
           A   ?  88  nl                                                
0000004
$ 

Update: Since 1.7.12 native git on OS X has an option to precompose non-ASCII characters in a way that is compatible with both EGit and Git on Windows. You need to configure core.precomposeunicode to true.

like image 95
robinr Avatar answered Dec 08 '25 02:12

robinr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!