Today when using Mac Terminal, solve two Chinese garble problem, record.
Git status Chinese garbled characters
Today, when I was sorting out my blog post, I found that the git status file showing the Chinese name was garbled. Because the name of the code file is basically in English when programming, we seldom pay attention to this problem. The default git status looks like this:
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
"\ 346\227\245\345\270\270 /"
nothing added to commit but untracked files present (use "git add" to track)
Copy the code
I searched the web for some solutions and found that only one Git configuration is required to solve this problem. The configuration command is as follows:
$ git config --global core.quotepath false
Copy the code
The official version of this option reads as follows:
Commands that output paths (e.g. ls-files, diff), will quote “unusual” characters in the pathname by enclosing the pathname in double-quotes and escaping those characters with backslashes in the same way C escapes control characters (e.g. \t for TAB, \n for LF, \ for backslash) or bytes with values larger than 0x80 (e.g. octal \302\265 for “micro” in UTF-8). If this variable is set to false, bytes higher than 0x80 are not considered “unusual” any more. Double-quotes, backslash and control characters are always escaped regardless of the setting of this variable. A simple space character is not considered “unusual”. Many commands can output pathnames completely verbatim using the -zoption. The default value is true.
To prevent escape problems, encodings greater than 0x80 are considered “unusual” and need to be quoted. If set to false, UTF8 encoding is used to resolve garbled characters.
Tree Indicates the directory tree is garbled
Is really strange, garbled code and I for the enemy ah! Today, I encountered the second garbled Code problem. In order to make the screen display more area when writing the article, I closed the VS Code sidebar, and then looked at the directory tree through the tree. The result appeared as follows:
. ├ ─ ─ Go \ 210 � � \ � 231 � \ │ └ ─ ─ Go \ 210 � � \ � \ 231 � � � please \ 202 \ \ 213 HTTP QuickStart. Md ├ ─ ─ Go, �, 224 down │ ├ ─ ─ explanation \ Go \ � \ 232\204 � 226 � � \ \ 221\211 � � 214 � � \ \ 201\213. Md │ └ ─ ─ for � 200 � � \ \ 210\201 \ Go learning md ├ ─ ─ Go \ � � \ 217\237 � � \ 206 ├ ─ ─ the README. Md ├ ─ ─ � 227 � \ often │ └ ─ ─ Mac \ 216 � � \ � \ 210 � � 217 � � \ \ 226\207 disorderly � \ two � � 201\232\204\235\221 md └ ─ ─ � \ 204 ├ ─ ─ pm2 \ Tube � � � \ 233\213\220\206 � � � 205\224 � � \ 200 � � \ 223 md ├ ─ ─ � � \ 200\226\207 fine � \ 200\232 \ crontab \ � � \ 216\205 � � \ 227 � � \ 210 � � \ 207 � � \ 235\221 md └ ─ ─ fast � \ � 200\237\206 solution, kafka, �, 237 � � � \ 200\236 � � \ 236\204 mdCopy the code
You can use tree-n to solve the problem. The result is as follows:
│ ├ ─ ─ Go creeper └ ─ ─ the QuickStart HTTP requests Go creeper. Md ├ ─ ─ Go notes │ ├ ─ ─ explanation Go compiler implementation process. The md │ └ ─ ─ why want to learn. The md ├ ─ ─ Go little knowledge ├ ─ ─ the README. Md ├ ─ ─ daily │ └ ─ ─ Mac console Chinese garbled two pit. Md └ ─ ─ component ├ ─ ─ pm2 process management tools use summary. Md ├ ─ ─ is proficient in crontab from entry to the pit. Md └ ─ ─ quickly understand kafka infrastructure. The mdCopy the code
By default, some non-print characters will be pressed. Processing, you can look at the -q option.