Setup
- Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.27.0.windows.1.8.ga98b073ae2.20200618202904
cpu: x86_64
built from commit: a98b073ae2b993892641bb1eb6ce707cc673d9ad
sizeof-long: 4
sizeof-size_t: 8
- Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver
Microsoft Windows [版本 10.0.19041.329]
- What options did you set as part of the installation? Or did you choose the
defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt
I installed (unzipped) the portable x64 version to `D:\Git`
- Any other interesting things about your environment that might be related
to the issue you're seeing?
No
Details
- Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other
Open bash.exe directly and then bash runs in a console window
PS1='$ '
echo -e '\[\e]0;123 测试\007\]'
- What did you expect to occur after running these commands?
The console window should update the text on its title bar into "123 测试" (3 English numbers and 2 Chinese characters)
- What actually happened instead?
The "测试" was converted into a mess (it seemed it was using a wrong coding page)
- If the problem was occurring with a specific repository, can you provide the
URL to that repository to help us with testing?
No repo related.
Further tests
Code analysis
iconv.exe can be used to work it around: the code below can make the title show Chinese characters as expected.
PS1='$ '
a=$(iconv.exe -f utf-8 -t gbk <<<测试)
echo -e '\[\e]0;123 '$a'\007\]'
This means my console accepts Chinese characters in the GBK encoding, but the msys2 runtime sent the UTF-8 version.
I think this is a bug of msys2 runtime, and it should do similar conversions as it has done when outputting characters to the console.
Setup
defaults?
to the issue you're seeing?
No
Details
Open
bash.exedirectly and then bash runs in a console windowMinimal, Complete, and Verifiable example
this will help us understand the issue.
The console window should update the text on its title bar into "
123 测试" (3 English numbers and 2 Chinese characters)The "
测试" was converted into a mess (it seemed it was using a wrong coding page)URL to that repository to help us with testing?
No repo related.
Further tests
MSYS2-packagesas I once did in MinTTY crashes frequently with a Git Bash using Windows-native pseudo consoles #2687, and this issue is reproducedmsys-2.0.dllandbash.exe, and this issue occurs thereCode analysis
iconv.execan be used to work it around: the code below can make the title show Chinese characters as expected.This means my console accepts Chinese characters in the
GBKencoding, but the msys2 runtime sent the UTF-8 version.I think this is a bug of msys2 runtime, and it should do similar conversions as it has done when outputting characters to the console.