Unicode (utf-8) with git-bash Unicode (utf-8) with git-bash windows windows

Unicode (utf-8) with git-bash


I faced the same issue in MSYS Git 2.8.0 and as it turned out it just needed changing the configuration.

$ git --versiongit version 2.8.0.windows.1

The default configuration of Git Bash console in my system did not show Greek filenames.

$cd ~$lsAppData/'Application Data'@Contacts/Cookies@Desktop/Documents/Downloads/Favorites/Links/'Local Settings'@NTUSER.DAT...''$'\316\244\316\261'' '$'\316\255\316\263\316\263\317\201\316\261\317\206\316\254'' '$'\316\274\316\277\317\205'@

The last line should display "Τα έγγραφά μου", the greek translation of "My Documents". In order to fix it I followed the below steps:

  1. Check your existing locale configuration

    $localeLANG=enLC_CTYPE="C"LC_NUMERIC="C"LC_TIME="C"LC_COLLATE="C"LC_MONETARY="C"LC_MESSAGES="C"LC_ALL=

    As shown above, in my case it was not UTF-8

  2. Change the locale to a UTF-8 encoding. Click the icon on the left side of MINGW title bar, select "Options" and in the "Text" category choose "UTF-8" Character set. You should also choose a unicode font, such as the default "Lucida Console". My configuration looks as following:MinGW locale configuration

  3. Change the language for the current window (no need to do this on future windows, as they will be created with the settings of step 2)

     $ LANG='C.UTF-8'
  4. The ls command should now display properly

    AppData/'Application Data'@Contacts/Cookies@Desktop/Documents/Downloads/Favorites/Links/'Local Settings'@NTUSER.DAT...'Τα έγγραφά μου'@


Found this answer elsewhere:

chcp.com 65001

Git bash chcp windows7 encoding issue

That's what actually solved it for me.


As CharlesB said in a comment, msysgit 1.7.10 handles unicode correctly. There are still a few issues but I can confirm that updating did solve the issue I was having.

See: https://github.com/msysgit/msysgit/wiki/Git-for-Windows-Unicode-Support