designetwork(EN)

IT technical memo of networking

How to deal with garbled characters where Japanese is displayed in \xx in Git Bash

f:id:daichi703n:20161210194309p:plain

When using widely used version management tool Git on Windows, use Git for Windows (Git Bash).

When handling Japanese files, describe the correspondence between garbled characters that are displayed as \xx (backslash, \mark number).

Installation procedure of Git for Windows (Git Bash)

Please refer here for the download and installation procedure.

git-for-windows.github.io

What to do when Japanese is displayed with \xx (\digit)

By default, Git Bash makes Japanese files look garbled. However, it is not merely a garbled character, and Japanese is displayed as \xx (backslash digit) respectively.

Such a Japanese folder,

f:id:daichi703n:20161210193151j:plain

this is displayed.

f:id:daichi703n:20161210193218j:plain

In this case, it is necessary to change the locale and font setting of Git Bash as the initial setting. Click the icon in the upper left corner of the window or right click on the screen and select Options.

f:id:daichi703n:20161210193352j:plain

Since it is empty like this by default, select ja_JP.

f:id:daichi703n:20161210193437j:plain

Also select MS Gothic from Font> Select.

f:id:daichi703n:20161210193631j:plain

Finally, this state is reached. Character set select UTF-8, SJIS as appropriate.

f:id:daichi703n:20161210193748j:plain

Restart Git Bash

Here Restart (close and open) Git Bash.

This makes it possible to display Japanese without garbling.

f:id:daichi703n:20161210193848j:plain

Conclusion - How to deal Japanese in Git Bash

When Git Bash is in the initial state, the Japanese file/folder is displayed as \xx (backslash digit). By setting Locale and Font and restarting Git Bash, Japanese can be normally displayed.


This Blog is English Version of my JP's.

Sorry if my English sentences are incorrect.

designetwork