encoding problem #21768

Closed
opened 2026-01-31 07:54:22 +00:00 by claunia · 9 comments
Owner

Originally created by @lelelemr on GitHub (May 25, 2024).

There seems to be some encoding issues when I use git bash in terminal. Commands such as ls do not contain garbled characters, but commands such as git status do.

terminal setting:

                 ...},{
                "commandline": "D:\\Git\\Git\\bin\\bash.exe -li",
                "guid": "{5cb277fc-2e8b-48ea-b0ea-f7f673df0fab}",
                "hidden": false,
                "icon": "D:\\Git\\Git\\mingw64\\share\\git\\git-for-windows.ico",
                "name": "Git Bash",
                "startingDirectory": "%USERPROFILE%",
                "tabTitle": null
            }

problem like this:
image
image

when i use powershell and runchcp 65001. it can be solved. what can i do to solve this in terminal page 'Git Bash'?

Originally created by @lelelemr on GitHub (May 25, 2024). There seems to be some encoding issues when I use git bash in terminal. Commands such as ls do not contain garbled characters, but commands such as git status do. terminal setting: ``` ...},{ "commandline": "D:\\Git\\Git\\bin\\bash.exe -li", "guid": "{5cb277fc-2e8b-48ea-b0ea-f7f673df0fab}", "hidden": false, "icon": "D:\\Git\\Git\\mingw64\\share\\git\\git-for-windows.ico", "name": "Git Bash", "startingDirectory": "%USERPROFILE%", "tabTitle": null } ``` problem like this: ![image](https://github.com/microsoft/terminal/assets/130736717/af7711ba-64d3-4749-a07c-57e7a7f032e1) ![image](https://github.com/microsoft/terminal/assets/130736717/013baa4b-05ae-4b1b-8fc3-15e6fb9695ed) when i use powershell and run`chcp 65001`. it can be solved. what can i do to solve this in terminal page 'Git Bash'?
Author
Owner

@lelelemr commented on GitHub (May 25, 2024):

Is there any solution other than changing the computer Settings to 'Time Zone '&beta?

@lelelemr commented on GitHub (May 25, 2024): Is there any solution other than changing the computer Settings to 'Time Zone '&beta?
Author
Owner

@lhecker commented on GitHub (May 27, 2024):

We used to have issues with the codepage not being set to 65001, but that was in 2020. What version of git-for-windows do you have installed? You can check with git --version. Ideally, it should be 2.45.1.windows.1. You can get the latest version here: https://gitforwindows.org/
...or you can run git update-git-for-windows.

@lhecker commented on GitHub (May 27, 2024): We used to have issues with the codepage not being set to 65001, but that was in 2020. What version of git-for-windows do you have installed? You can check with `git --version`. Ideally, it should be `2.45.1.windows.1`. You can get the latest version here: https://gitforwindows.org/ ...or you can run `git update-git-for-windows`.
Author
Owner

@e71828 commented on GitHub (May 31, 2024):

I have the same problem.
with the info:

$ git --version
git version 2.45.1.windows.1

Btw,
Chinese char dispaly normally in git bash by Start Menu.
But, windows terminal gives GBK2312 format.

@e71828 commented on GitHub (May 31, 2024): I have the same problem. with the info: ```bash $ git --version git version 2.45.1.windows.1 ``` Btw, Chinese char dispaly normally in `git bash` by `Start Menu`. But, `windows terminal` gives `GBK2312` format.
Author
Owner

@e71828 commented on GitHub (May 31, 2024):

chcp.com 65001 可以解决问题

@e71828 commented on GitHub (May 31, 2024): chcp.com 65001 可以解决问题
Author
Owner

@lhecker commented on GitHub (May 31, 2024):

@e71828 can you share your settings.json with us? You can find it by pressing Ctrl+Shift+,
You don't need to share the entire file as I'm only interested in your git bash profile. I'd like to know what commandline it has.

@lhecker commented on GitHub (May 31, 2024): @e71828 can you share your settings.json with us? You can find it by pressing Ctrl+Shift+, You don't need to share the entire file as I'm only interested in your `git bash` profile. I'd like to know what `commandline` it has.
Author
Owner

@e71828 commented on GitHub (Jun 2, 2024):

            {
                "guid": "{2ece5bfe-50ed-5f3a-ab87-5cd4baafed2b}",
                "hidden": false,
                "name": "Git Bash",
                "source": "Git"
            },

this is my setings json auto-generated by Git-2.45.1-64-bit.exe. And now I append chcp.com 65001 > /dev/null 2>&1 to my .bash_profile.

@e71828 commented on GitHub (Jun 2, 2024): ```json { "guid": "{2ece5bfe-50ed-5f3a-ab87-5cd4baafed2b}", "hidden": false, "name": "Git Bash", "source": "Git" }, ``` this is my `setings json` auto-generated by `Git-2.45.1-64-bit.exe`. And now I append `chcp.com 65001 > /dev/null 2>&1` to my `.bash_profile`.
Author
Owner

@lelelemr commented on GitHub (Jun 2, 2024):

thank you. I solved the problem in your way

@lelelemr commented on GitHub (Jun 2, 2024): thank you. I solved the problem in your way
Author
Owner

@ianjoneill commented on GitHub (Jun 3, 2024):

You might be hitting https://github.com/git-for-windows/git/issues/4851 - can you try upgrading to version 2.45.2 of Git for Windows? (It was released today).

@ianjoneill commented on GitHub (Jun 3, 2024): You might be hitting https://github.com/git-for-windows/git/issues/4851 - can you try upgrading to version 2.45.2 of Git for Windows? (It was released today).
Author
Owner

@carlos-zamora commented on GitHub (Jun 5, 2024):

Thanks for finding the fix! Closing as external

@carlos-zamora commented on GitHub (Jun 5, 2024): Thanks for finding the fix! Closing as external
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21768