print of 'ls' is not utf-8 (gitbash in wt) #7262

Closed
opened 2026-01-31 00:59:24 +00:00 by claunia · 7 comments
Owner

Originally created by @yobome on GitHub (Apr 3, 2020).

Issues

I added git bash in wt:

image

and when I input ls, then:

image

but when I open git bash (not using wt), it uses utf8:
image

how can I fix it?

Environment

Windows build number: windows10 1909 (10.0.18363.752)
Windows Terminal version (if applicable): 0.10.781.0

Originally created by @yobome on GitHub (Apr 3, 2020). # Issues I added git bash in wt: ![image](https://user-images.githubusercontent.com/26548120/78368177-cc1b4d00-75f5-11ea-9ba0-dcbdba1ad4c0.png) and when I input ls, then: ![image](https://user-images.githubusercontent.com/26548120/78368619-785d3380-75f6-11ea-8c95-399232506d3f.png) but when I open git bash (not using wt), it uses utf8: ![image](https://user-images.githubusercontent.com/26548120/78368721-a3e01e00-75f6-11ea-9dca-78c436c5d2b6.png) how can I fix it? # Environment Windows build number: windows10 1909 (10.0.18363.752) Windows Terminal version (if applicable): 0.10.781.0
claunia added the Issue-QuestionNeeds-Tag-FixResolution-AnsweredProduct-Terminal labels 2026-01-31 00:59:25 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Apr 3, 2020):

What is TERM, LANG, LC_ALL set to when running git bash in the Windows Terminal? What are their values when running in git bash directly?

What commandline are you providing for git bash in your profiles.json?

@zadjii-msft commented on GitHub (Apr 3, 2020): What is `TERM`, `LANG`, `LC_ALL` set to when running git bash in the Windows Terminal? What are their values when running in git bash directly? What `commandline` are you providing for git bash in your `profiles.json`?
Author
Owner

@yobome commented on GitHub (Apr 3, 2020):

How to check them? "echo $LC_ALL" doesn't work.

the value of commandline : "commandline": "D:\Git\bin\bash.exe"

@yobome commented on GitHub (Apr 3, 2020): How to check them? "echo $LC_ALL" doesn't work. the value of commandline : "commandline": "D:\\Git\\bin\\bash.exe"
Author
Owner

@yobome commented on GitHub (Apr 3, 2020):

OK, I edit "bash.bashrc" in "%GITHOME%/Git/etc/".

add two lines in the tail:
export LANG="zh_CN.UTF-8"
export LC_ALL="zh_CN.UTF-8"

and it works.

thanks for your help!

@yobome commented on GitHub (Apr 3, 2020): OK, I edit "bash.bashrc" in "%GITHOME%/Git/etc/". add two lines in the tail: export LANG="zh_CN.UTF-8" export LC_ALL="zh_CN.UTF-8" and it works. thanks for your help!
Author
Owner

@yobome commented on GitHub (Apr 3, 2020):

but I still wonder why it works when I use git bash directly......

@yobome commented on GitHub (Apr 3, 2020): but I still wonder why it works when I use git bash directly......
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 3, 2020):

Try changing your commandline to end with bash.exe -li

@DHowett-MSFT commented on GitHub (Apr 3, 2020): Try changing your commandline to end with `bash.exe -li`
Author
Owner

@yobome commented on GitHub (Apr 3, 2020):

Try changing your commandline to end with bash.exe -li

it works!

What does "-li" mean?

@yobome commented on GitHub (Apr 3, 2020): > Try changing your commandline to end with `bash.exe -li` it works! What does "-li" mean?
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 3, 2020):

-li means --login and --interactive. They're two important arguments to make sure that Bash gets started up in the right configuration. The git-for-windows folks let us know that we were missing it in our config example 😄

@DHowett-MSFT commented on GitHub (Apr 3, 2020): `-li` means `--login` and `--interactive`. They're two important arguments to make sure that Bash gets started up in the right configuration. The git-for-windows folks let us know that we were missing it in our config example :smile:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7262