Skip to content

Commit

Permalink
git-gui--askpass: coerce answers to UTF-8 on Windows
Browse files Browse the repository at this point in the history
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 git-for-windows#2215

Signed-off-by: Luke Bonanomi <lbonanomi@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
  • Loading branch information
lbonanomi authored and prati0100 committed Mar 14, 2020
1 parent d769dcc commit 850cf9a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions git-gui--askpass
Expand Up @@ -56,6 +56,11 @@ proc finish {} {
}
}

# On Windows, force the encoding to UTF-8: it is what `git.exe` expects
if {$::tcl_platform(platform) eq {windows}} {
set ::answer [encoding convertto utf-8 $::answer]
}

puts $::answer
set ::rc 0
}
Expand Down

0 comments on commit 850cf9a

Please sign in to comment.