Skip to content

Commit a7be4f4

Browse files
lbonanomidscho
authored andcommitted
git-gui--askpass: coerce answers to UTF-8 on Windows
This addresses the issue where Git for Windows asks the user for a password, no credential helper is available, and then Git fails to pick up non-ASCII characters from the Git GUI helper. This can be verified e.g. via echo host=http://abc.com | git -c credential.helper= credential fill and then pasting some umlauts. The underlying reason is that Git for Windows tries to communicate using the UTF-8 encoding no matter what the actual current code page is. So let's indulge Git for Windows and do use that encoding. This fixes #2215 Signed-off-by: Luke Bonanomi <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent e0fbc27 commit a7be4f4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

git-gui/git-gui--askpass

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ proc finish {} {
5656
}
5757
}
5858

59+
# On Windows, force the encoding to UTF-8: it is what `git.exe` expects
60+
if {$::tcl_platform(platform) eq {windows}} {
61+
set ::answer [encoding convertto utf-8 $::answer]
62+
}
63+
5964
puts $::answer
6065
set ::rc 0
6166
}

0 commit comments

Comments
 (0)