Sunday, April 1, 2018

Japanese in Git

Vấn đề: git status trong git bash không hiển thị được tên file tiếng nhật

Git quotes any non-ascii character by default, not only asian ones. There's an option to disable this quoting behaviour.
You can disable it using the following command:
git config --global core.quotepath false
Or, alternatively, by adding the following snippet to your git config file ($HOME/.gitconfig usually)
[core]
    quotepath = false
After this, git should show your filenames exactly as they are.
As to your other problem, git not adding a file with asian characters, I can only guess that it has to do with the encoding that git uses is not the same as the encoding your terminal uses. I hope someone else can jump in and explain that bit.

----------

Vấn đề: ls trong git bash sẽ không hiển thị được tên file tiếng nhật

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

Here Restart (close and open) Git Bash.
This makes it possible to display Japanese without garbling.

1 comment:

  1. chốt: chỉ cần tắt quoting
    git config --global core.quotepath false
    mấy cái cấu hình của bọn nhật đếch cần quan tâm

    ReplyDelete