Backspacing å, ä or ö in Git Bash inside Windows Terminal leaves □ character #19439

Closed
opened 2026-01-31 06:43:18 +00:00 by claunia · 10 comments
Owner

Originally created by @Godsmith on GitHub (Feb 23, 2023).

Windows Terminal version

1.16.10261.0

Windows build number

10.0.19044.2486

Other Software

git version 2.34.1.windows.1

Steps to reproduce

  1. Open Git Bash inside Windows Terminal
  2. Type "echo ö" without quotes
  3. Press Backspace
  4. Type "hello" so that the input now says "echo hello".
  5. Press Enter

Expected Behavior

The command outputs "hello".

Actual Behavior

The command outputs "□hello".

image

Backspacing an å, ä or ö seems to leave some kind of "residual character" that is not visible when entering the input. Backspacing twice removes also this character.

This is only an issue in Git Bash inside Windows Terminal specifically. Git Bash standalone works as expected. All other shells inside Windows Terminal works as expected.

Originally created by @Godsmith on GitHub (Feb 23, 2023). ### Windows Terminal version 1.16.10261.0 ### Windows build number 10.0.19044.2486 ### Other Software git version 2.34.1.windows.1 ### Steps to reproduce 1. Open Git Bash inside Windows Terminal 2. Type "echo ö" without quotes 3. Press Backspace 4. Type "hello" so that the input now says "echo hello". 5. Press Enter ### Expected Behavior The command outputs "hello". ### Actual Behavior The command outputs "□hello". ![image](https://user-images.githubusercontent.com/6632699/220851961-34f2d35e-a1b5-41b8-ada0-46b60a8ac88c.png) Backspacing an å, ä or ö seems to leave some kind of "residual character" that is not visible when entering the input. Backspacing twice removes also this character. This is only an issue in Git Bash inside Windows Terminal specifically. Git Bash standalone works as expected. All other shells inside Windows Terminal works as expected.
Author
Owner

@Godsmith commented on GitHub (Feb 23, 2023):

Deleting an å, ä or ö by placing the cursor before the character and pressing the Delete key also leaves the residual character.

@Godsmith commented on GitHub (Feb 23, 2023): Deleting an å, ä or ö by placing the cursor before the character and pressing the Delete key also leaves the residual character.
Author
Owner

@zadjii-msft commented on GitHub (Feb 23, 2023):

Hmm, I suspect this is a git bash bug. In MinTTY I get the following:
image

though, gnome-terminal on WSL bash seems fine:
image

I bet there's an upstream bug for this

@zadjii-msft commented on GitHub (Feb 23, 2023): Hmm, I suspect this is a git bash bug. In MinTTY I get the following: ![image](https://user-images.githubusercontent.com/18356694/220896469-84d4b84f-8e4f-41c8-b065-cb780062d6e8.png) though, `gnome-terminal` on WSL bash seems fine: ![image](https://user-images.githubusercontent.com/18356694/220896560-96048c87-bcf6-42d8-9b27-dda98cdca8a3.png) I bet there's an upstream bug for this
Author
Owner

@Godsmith commented on GitHub (Feb 23, 2023):

Oh, interesting. I cannot reproduce it with just Git Bash, which is why I thought it was a Windows Terminal issue.

@Godsmith commented on GitHub (Feb 23, 2023): Oh, interesting. I cannot reproduce it with just Git Bash, which is why I thought it was a Windows Terminal issue.
Author
Owner

@carlos-zamora commented on GitHub (Mar 8, 2023):

Hi @Godsmith. Would you mind sharing a screen recording of Git Bash in the working case?

@carlos-zamora commented on GitHub (Mar 8, 2023): Hi @Godsmith. Would you mind sharing a screen recording of Git Bash in the working case?
Author
Owner

@Godsmith commented on GitHub (Mar 9, 2023):

Working when using just Git Bash not inside Windows Terminal:

https://user-images.githubusercontent.com/6632699/223971567-f8cf5bcf-6d98-4faf-b14f-e7d418f72e36.mp4

@Godsmith commented on GitHub (Mar 9, 2023): Working when using just Git Bash not inside Windows Terminal: https://user-images.githubusercontent.com/6632699/223971567-f8cf5bcf-6d98-4faf-b14f-e7d418f72e36.mp4
Author
Owner

@DHowett commented on GitHub (Mar 9, 2023):

Awesome, thanks!

Can you share the output of locale in the working case and the non-working case?

In addition... how are you spawning Git Bash inside Terminal? Are you using the profile that Git for Windows created, or have you created your own? If so, what is the command line?

@DHowett commented on GitHub (Mar 9, 2023): Awesome, thanks! Can you share the output of `locale` in the working case and the non-working case? In addition... how are you spawning Git Bash inside Terminal? Are you using the profile that Git for Windows created, or have you created your own? If so, what is the command line?
Author
Owner

@Godsmith commented on GitHub (Mar 10, 2023):

Working:

$ locale
LANG=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_ALL=

Non-working:

$ locale
LANG=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_ALL=

LC_CTYPE is different.

I think I created my own. I was not aware that Git for Windows created its own.

Not sure what you mean with "what is the command line", I created it from the settings GUI. Here are the settings:

image

But I tried running C:\Program Files\Git\bin\bash.exe from cmd, and then I also get the non-working behavior! The standalone Git Bash runs C:\Program Files\Git\git-bash.exe instead, which exhibits the working behavior. So it is indeed the fault of git bash then. Thanks for helping me suss this out.

@Godsmith commented on GitHub (Mar 10, 2023): Working: ``` $ locale LANG= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="C.UTF-8" LC_TIME="C.UTF-8" LC_COLLATE="C.UTF-8" LC_MONETARY="C.UTF-8" LC_MESSAGES="C.UTF-8" LC_ALL= ``` Non-working: ``` $ locale LANG= LC_CTYPE="C.UTF-8" LC_NUMERIC="C.UTF-8" LC_TIME="C.UTF-8" LC_COLLATE="C.UTF-8" LC_MONETARY="C.UTF-8" LC_MESSAGES="C.UTF-8" LC_ALL= ``` LC_CTYPE is different. I think I created my own. I was not aware that Git for Windows created its own. Not sure what you mean with "what is the command line", I created it from the settings GUI. Here are the settings: ![image](https://user-images.githubusercontent.com/6632699/224244641-1a9595dc-4ec8-459d-8ea6-c06ea60ac9a1.png) But I tried running C:\Program Files\Git\bin\bash.exe from cmd, and then I also get the non-working behavior! The standalone Git Bash runs C:\Program Files\Git\git-bash.exe instead, which exhibits the working behavior. So it is indeed the fault of git bash then. Thanks for helping me suss this out.
Author
Owner

@Godsmith commented on GitHub (Mar 10, 2023):

Manually setting

export LC_CTYPE="en_US.UTF-8"

in my .bashrc did the trick, now everything is working properly even inside Windows Terminal. Thanks for bringing this to my attention, I wasn't aware how this worked.

@Godsmith commented on GitHub (Mar 10, 2023): Manually setting `export LC_CTYPE="en_US.UTF-8"` in my .bashrc did the trick, now everything is working properly even inside Windows Terminal. Thanks for bringing this to my attention, I wasn't aware how this worked.
Author
Owner

@zadjii-msft commented on GitHub (Mar 10, 2023):

Glad to hear you got this figured out! Suffice to say I think we all learned something here today ☺️

@zadjii-msft commented on GitHub (Mar 10, 2023): Glad to hear you got this figured out! Suffice to say I think we all learned something here today ☺️
Author
Owner

@DHowett commented on GitHub (Mar 10, 2023):

Sure!

Regarding this:

Not sure what you mean with "what is the command line", I created it from the settings GUI. Here are the settings:

Ah, that would be this part:
image

If you change that to bash.exe -l -i, i bet this will just work without you setting LC_CTYPE manually!

Git for Windows' bash does not do certain initialization unless it is started as an interactive (-i) login (-l) shell. One of those things might be sourcing the locale environment block.

@DHowett commented on GitHub (Mar 10, 2023): Sure! Regarding this: > Not sure what you mean with "what is the command line", I created it from the settings GUI. Here are the settings: Ah, that would be this part: <img width="587" alt="image" src="https://user-images.githubusercontent.com/189190/224388241-24fa3dd0-f553-4e22-ba40-532c6d1e7705.png"> If you change that to `bash.exe -l -i`, i bet this will just work without you setting `LC_CTYPE` manually! Git for Windows' bash does not do certain initialization unless it is started as an interactive (`-i`) login (`-l`) shell. One of those things might be sourcing the locale environment block.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19439