Only one part of unicode character get deleted on backspace in git bash for windows #7060

Closed
opened 2026-01-31 00:54:00 +00:00 by claunia · 8 comments
Owner

Originally created by @wallymathieu on GitHub (Mar 21, 2020).

Environment

PS C:\Users\osge> [Environment]::OSVersion

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.19041.0 Microsoft Windows NT 10.0.19041.0

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
Windows Terminal version (if applicable): Version: 0.10.781.0 and older

Git for windows : 2.25.1.windows.1 and older

https://github.com/git-for-windows/git/releases/tag/v2.25.1.windows.1

Steps to reproduce

For git bash set
locale C character set UTF-8 :

LANG=C.UTF-8

Start a windows terminal with git bash:

      {
        "guid": "{c72ed3ae-ef92-4961-ba3b-c51ae3021680}",
        "commandline": "C:\\Program Files\\Git\\bin\\bash.exe",
        "icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",
        "name": "GitHub",
        "startingDirectory": "%USERPROFILE%\\Documents\\GitHub",
      },

Enter Swedish character

öåä

Delete a character

Expected behavior

expect the single character to be deleted

Actual behavior

part of the character gets deleted, you get an invisible character left causing issues with further input

Originally created by @wallymathieu on GitHub (Mar 21, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none PS C:\Users\osge> [Environment]::OSVersion Platform ServicePack Version VersionString -------- ----------- ------- ------------- Win32NT 10.0.19041.0 Microsoft Windows NT 10.0.19041.0 Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] Windows Terminal version (if applicable): Version: 0.10.781.0 and older Git for windows : 2.25.1.windows.1 and older ``` https://github.com/git-for-windows/git/releases/tag/v2.25.1.windows.1 # Steps to reproduce For git bash set locale C character set UTF-8 : ```env LANG=C.UTF-8 ``` Start a windows terminal with git bash: ```json { "guid": "{c72ed3ae-ef92-4961-ba3b-c51ae3021680}", "commandline": "C:\\Program Files\\Git\\bin\\bash.exe", "icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico", "name": "GitHub", "startingDirectory": "%USERPROFILE%\\Documents\\GitHub", }, ``` Enter Swedish character ```none öåä ``` Delete a character <!-- A description of how to trigger this bug. --> # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> expect the single character to be deleted # Actual behavior part of the character gets deleted, you get an invisible character left causing issues with further input <!-- What's actually happening? -->
claunia added the Needs-Tag-FixNeeds-Attention labels 2026-01-31 00:54:00 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 24, 2020):

When I enter those characters, and then delete them, it works fine. Can you share some screenshots of what you're seeing?

@DHowett-MSFT commented on GitHub (Mar 24, 2020): When I enter those characters, and then delete them, it works fine. Can you share some screenshots of what you're seeing?
Author
Owner

@wallymathieu commented on GitHub (Mar 24, 2020):

I've added the following export .bashrc in order for git bash to work together with windows terminal:

export LC_ALL=sv_SE.utf8 

Git bash on it's own works fine without the LC_ALL configuration. It seems that in windows terminal without LC_ALL åöä gets translated into two bytes. When deleting the character, it looks like it works, but only part of the two byte character get deleted. If you continue deleting you delete the other hidden byte.

@wallymathieu commented on GitHub (Mar 24, 2020): I've added the following export .bashrc in order for git bash to work together with windows terminal: ``` export LC_ALL=sv_SE.utf8 ``` Git bash on it's own works fine without the LC_ALL configuration. It seems that in windows terminal without LC_ALL åöä gets translated into two bytes. When deleting the character, it looks like it works, but only part of the two byte character get deleted. If you continue deleting you delete the other hidden byte.
Author
Owner

@wallymathieu commented on GitHub (Mar 24, 2020):

MINGW64__c_Users_osge_Documents_GitHub 2020-03-24 06-45-14.zip
This video demonstrates how when you delete characters like ½ and åöä an extra hidden character is left (and how you can delete that). When entering for instance "eeeå" then deleting the last character "å", and using arrow up and down you see the "eee□".

@wallymathieu commented on GitHub (Mar 24, 2020): [MINGW64__c_Users_osge_Documents_GitHub 2020-03-24 06-45-14.zip](https://github.com/microsoft/terminal/files/4373408/MINGW64__c_Users_osge_Documents_GitHub.2020-03-24.06-45-14.zip) This video demonstrates how when you delete characters like ½ and åöä an extra hidden character is left (and how you can delete that). When entering for instance "eeeå" then deleting the last character "å", and using arrow up and down you see the "eee□".
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 24, 2020):

I have set my keyboard layout to Swedish (Sweden, not Finland), and I still cannot reproduce this issue.

Can you use cat to generate a text file with these characters in it?

cat >sv_se.txt
åöä½
<ctrl+d to end>

I'd like to see what bytes we're getting from the input stack. Thanks!

@DHowett-MSFT commented on GitHub (Mar 24, 2020): I have set my keyboard layout to Swedish (Sweden, not Finland), and I still cannot reproduce this issue. Can you use `cat` to generate a text file with these characters in it? ``` cat >sv_se.txt åöä½ <ctrl+d to end> ``` I'd like to see what bytes we're getting from the input stack. Thanks!
Author
Owner

@wallymathieu commented on GitHub (Mar 25, 2020):

sv_se.txt

@wallymathieu commented on GitHub (Mar 25, 2020): [sv_se.txt](https://github.com/microsoft/terminal/files/4382086/sv_se.txt)
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 27, 2020):

This is going to be a crazy question, but if you change your commandline from bash.exe to bash.exe -li, does it work better?

@DHowett-MSFT commented on GitHub (Mar 27, 2020): This is going to be a crazy question, but if you change your `commandline` from `bash.exe` to `bash.exe -li`, does it work better?
Author
Owner

@wallymathieu commented on GitHub (Mar 27, 2020):

Using bash -li makes the characters work as expected. Another solution is to set LC_ALL=sv_SE.utf8.

@wallymathieu commented on GitHub (Mar 27, 2020): Using `bash -li` makes the characters work as expected. Another solution is to set `LC_ALL=sv_SE.utf8`.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 27, 2020):

Thanks for confirming. THe Git folks let me know that things "won't work correctly" if we leave off the -li, so I've asked the person updating our third-party profiles documentation in #5141 to add it there.

Thanks for working with us on this! 😄

@DHowett-MSFT commented on GitHub (Mar 27, 2020): Thanks for confirming. THe Git folks let me know that things "won't work correctly" if we leave off the `-li`, so I've asked the person updating our third-party profiles documentation in #5141 to add it there. Thanks for working with us on this! :smile:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7060