Git for Windows Chinese garbled solution

Source: Internet
Author: User
Tags i18n using git

1. When using the git add command to add files with Chinese characters in the file name

Garbled like:

\304\261\276\304\265 \265.txt

Solution:

Edit the corresponding line in the C:\Git\etc\inputrc file,
Look for the following 2 lines and modify their values.
Original:

set output-meta offset Convert-meta on

Switch

set output-metaonset Convert-meta off
2. When using git log to view log information containing Chinese

Garbled like:

<E4><BF><AE><E6><94><B9><E6><$ ><87 ><E6><9C><AC><E6><>< ><E6><A1> <A3>

Solution:

At the bash prompt, enter:

git config--global i18n.commitencoding utf-8--global I18n.logoutputencoding GBK

Note: You can avoid garbled Linux servers by using UTF-8 encoding when setting commit commits, and also set the Utf-8 encoding to GBK encoding when you execute git log to solve garbled problems.
To edit the C:\Git\etc\profile file, add the following line:

Export lesscharset=utf-8

Note: To enable git log to display Chinese correctly (requires mates: i18n.logoutputencoding GBK)

3. When using the LS command to see the file names containing Chinese characters garbled

Garbled like:

????. Txt

Solution:

Use the ls–show-control-chars command to force the display of file names using console character encoding to view Chinese file names.
For ease of use, you can edit the C:\Git\etc\git-completion.bash file and add the following line:

Alias ls="ls--show-control-chars"
4. When viewing UTF-8 encoded text files in the Git GUI
Garbled like:
Nobelium à Andychia po Jean £

Solution:

At the bash prompt, enter:

git config--global gui.encoding utf-8

Note: Through the above settings, UTF-8 encoded text files can be viewed normally, but GBK encoded files will be garbled, so still did not fundamentally solve the problem.

One possible way is to unify the encoding of all text files to UTF-8 or GBK, and then set the corresponding gui.encoding parameter to Utf-8 or GBK.

Git for Windows Chinese garbled solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.