[Git] 修正中文顯示亂碼
Mar 22, 2017在 Mac 使用 git status
或 git ls-files
時,若 Git 在顯示中文檔名出現類似下面的亂碼:
"\321\203\321\201\321\202\320\260\320\275\320\276\320\262"
這是因為 Git 預設只會印出 non-ASCII 字串,對於 utf8 的檔名或訊息,會用 quoted octal notation 印出。
Git has always used octal utf8 display, and one way to show the actual name is by using printf in a bash shell.
Since Git 1.7.10 introduced the support of unicode, this wiki page mentions:
By default, git will print non-ASCII file names in quoted octal notation, i.e. “\nnn\nnn…”.
This can be disabled with:
git config [--global] core.quotepath off