{"thread":{"id":"52979","subject":"[PATCH] git-gui--askpass: coerce answers to UTF-8 on Windows","startedAt":"2020-03-11T19:24:42Z","lastAt":"2020-03-15T02:12:23Z","messageCount":5,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano","Pratyush Yadav"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"393081","messageId":"pull.578.git.1583954676691.gitgitgadget@gmail.com","threadId":"52979","inReplyTo":null,"subject":"[PATCH] git-gui--askpass: coerce answers to UTF-8 on Windows","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-03-11T19:24:36Z","receivedAt":"2020-03-11T19:24:42Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Luke Bonanomi <lbonanomi@gmail.com>\n\nThis addresses the issue where Git for Windows asks the user for a\npassword, no credential helper is available, and then Git fails to pick\nup non-ASCII characters from the Git GUI helper.\n\nThis can be verified e.g. via\n\n\techo host=http://abc.com |\n\tgit -c credential.helper= credential fill\n\nand then pasting some umlauts.\n\nThe underlying reason is that Git for Windows tries to communicate using\nthe UTF-8 encoding no matter what the actual current code page is. So\nlet's indulge Git for Windows and do use that encoding.\n\nThis fixes https://github.com/git-for-windows/git/issues/2215\n\nSigned-off-by: Luke Bonanomi <lbonanomi@gmail.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    Fix git-gui--askpass on Windows\n    \n    Windows has this odd thing where there is an active code page (somewhat\n    like LC_CTYPE) and there is no real UTF-8 code page. So we need to help \n    git-gui--askpass along a bit to be of use when asking for credentials.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-578%2Fdscho%2Fgit-gui--askpass-utf-8-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-578/dscho/git-gui--askpass-utf-8-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/578\n\n git-gui--askpass | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/git-gui--askpass b/git-gui--askpass\nindex 4277f30c411..b0704e6d91e 100755\n--- a/git-gui--askpass\n+++ b/git-gui--askpass\n@@ -56,6 +56,11 @@ proc finish {} {\n \t\t}\n \t}\n \n+\t# On Windows, force the encoding to UTF-8: it is what `git.exe` expects\n+\t\tif {$::tcl_platform(platform) eq {windows}} {\n+\t\tset ::answer [encoding convertto utf-8 $::answer]\n+\t}\n+\n \tputs $::answer\n \tset ::rc 0\n }\n\nbase-commit: 63a58457e094c9c9bbf562b872009d32f1f88133\n-- \ngitgitgadget\n"},{"id":"393090","messageId":"xmqqa74mhcjb.fsf@gitster.c.googlers.com","threadId":"52979","inReplyTo":"pull.578.git.1583954676691.gitgitgadget@gmail.com","subject":"Re: [PATCH] git-gui--askpass: coerce answers to UTF-8 on Windows","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-03-11T20:17:12Z","receivedAt":"2020-03-11T20:17:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> diff --git a/git-gui--askpass b/git-gui--askpass\n> index 4277f30c411..b0704e6d91e 100755\n> --- a/git-gui--askpass\n> +++ b/git-gui--askpass\n> @@ -56,6 +56,11 @@ proc finish {} {\n>  \t\t}\n>  \t}\n>  \n> +\t# On Windows, force the encoding to UTF-8: it is what `git.exe` expects\n> +\t\tif {$::tcl_platform(platform) eq {windows}} {\n\nThe indentation looks funny here.  Dedent one level?\n\n> +\t\tset ::answer [encoding convertto utf-8 $::answer]\n> +\t}\n\nLooks correct (assuming that $::answer we got is Unicode \"string\",\nand I think that is a sane assumpton as it came directly from a\ntextvariable bound to an entry widget).\n\n>  \tputs $::answer\n>  \tset ::rc 0\n>  }\n>\n> base-commit: 63a58457e094c9c9bbf562b872009d32f1f88133\n"},{"id":"393177","messageId":"pull.578.v2.git.1584048710895.gitgitgadget@gmail.com","threadId":"52979","inReplyTo":"pull.578.git.1583954676691.gitgitgadget@gmail.com","subject":"[PATCH v2] git-gui--askpass: coerce answers to UTF-8 on Windows","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-03-12T21:31:50Z","receivedAt":"2020-03-12T21:31:55Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Luke Bonanomi <lbonanomi@gmail.com>\n\nThis addresses the issue where Git for Windows asks the user for a\npassword, no credential helper is available, and then Git fails to pick\nup non-ASCII characters from the Git GUI helper.\n\nThis can be verified e.g. via\n\n\techo host=http://abc.com |\n\tgit -c credential.helper= credential fill\n\nand then pasting some umlauts.\n\nThe underlying reason is that Git for Windows tries to communicate using\nthe UTF-8 encoding no matter what the actual current code page is. So\nlet's indulge Git for Windows and do use that encoding.\n\nThis fixes https://github.com/git-for-windows/git/issues/2215\n\nSigned-off-by: Luke Bonanomi <lbonanomi@gmail.com>\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    Fix git-gui--askpass on Windows\n    \n    Windows has this odd thing where there is an active code page (somewhat\n    like LC_CTYPE) and there is no real UTF-8 code page. So we need to help \n    git-gui--askpass along a bit to be of use when asking for credentials.\n    \n    Changes since v1:\n    \n     * Fixed indentation\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-578%2Fdscho%2Fgit-gui--askpass-utf-8-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-578/dscho/git-gui--askpass-utf-8-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/578\n\nRange-diff vs v1:\n\n 1:  3beec773772 ! 1:  7891941486d git-gui--askpass: coerce answers to UTF-8 on Windows\n     @@ -20,6 +20,7 @@\n          This fixes https://github.com/git-for-windows/git/issues/2215\n      \n          Signed-off-by: Luke Bonanomi <lbonanomi@gmail.com>\n     +    Helped-by: Junio C Hamano <gitster@pobox.com>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       diff --git a/git-gui--askpass b/git-gui--askpass\n     @@ -30,7 +31,7 @@\n       \t}\n       \n      +\t# On Windows, force the encoding to UTF-8: it is what `git.exe` expects\n     -+\t\tif {$::tcl_platform(platform) eq {windows}} {\n     ++\tif {$::tcl_platform(platform) eq {windows}} {\n      +\t\tset ::answer [encoding convertto utf-8 $::answer]\n      +\t}\n      +\n\n\n git-gui--askpass | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/git-gui--askpass b/git-gui--askpass\nindex 4277f30c411..1c99ee8ca20 100755\n--- a/git-gui--askpass\n+++ b/git-gui--askpass\n@@ -56,6 +56,11 @@ proc finish {} {\n \t\t}\n \t}\n \n+\t# On Windows, force the encoding to UTF-8: it is what `git.exe` expects\n+\tif {$::tcl_platform(platform) eq {windows}} {\n+\t\tset ::answer [encoding convertto utf-8 $::answer]\n+\t}\n+\n \tputs $::answer\n \tset ::rc 0\n }\n\nbase-commit: 63a58457e094c9c9bbf562b872009d32f1f88133\n-- \ngitgitgadget\n"},{"id":"393190","messageId":"xmqq7dzpdsfy.fsf@gitster.c.googlers.com","threadId":"52979","inReplyTo":"pull.578.v2.git.1584048710895.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] git-gui--askpass: coerce answers to UTF-8 on Windows","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-03-13T00:11:45Z","receivedAt":"2020-03-13T00:11:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Luke Bonanomi <lbonanomi@gmail.com>\n>\n> This addresses the issue where Git for Windows asks the user for a\n> password, no credential helper is available, and then Git fails to pick\n> up non-ASCII characters from the Git GUI helper.\n>\n> This can be verified e.g. via\n>\n> \techo host=http://abc.com |\n> \tgit -c credential.helper= credential fill\n>\n> and then pasting some umlauts.\n>\n> The underlying reason is that Git for Windows tries to communicate using\n> the UTF-8 encoding no matter what the actual current code page is. So\n> let's indulge Git for Windows and do use that encoding.\n>\n> This fixes https://github.com/git-for-windows/git/issues/2215\n>\n> Signed-off-by: Luke Bonanomi <lbonanomi@gmail.com>\n> Helped-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n\nHeh, that is over-crediting me.  I didn't do anything other than\njust scan the code once.\n\n>     Fix git-gui--askpass on Windows\n>     \n>     Windows has this odd thing where there is an active code page (somewhat\n>     like LC_CTYPE) and there is no real UTF-8 code page. So we need to help \n>     git-gui--askpass along a bit to be of use when asking for credentials.\n>     \n>     Changes since v1:\n>     \n>      * Fixed indentation\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-578%2Fdscho%2Fgit-gui--askpass-utf-8-v2\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-578/dscho/git-gui--askpass-utf-8-v2\n> Pull-Request: https://github.com/gitgitgadget/git/pull/578\n>\n> Range-diff vs v1:\n>\n>  1:  3beec773772 ! 1:  7891941486d git-gui--askpass: coerce answers to UTF-8 on Windows\n>      @@ -20,6 +20,7 @@\n>           This fixes https://github.com/git-for-windows/git/issues/2215\n>       \n>           Signed-off-by: Luke Bonanomi <lbonanomi@gmail.com>\n>      +    Helped-by: Junio C Hamano <gitster@pobox.com>\n>           Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n>       \n>        diff --git a/git-gui--askpass b/git-gui--askpass\n>      @@ -30,7 +31,7 @@\n>        \t}\n>        \n>       +\t# On Windows, force the encoding to UTF-8: it is what `git.exe` expects\n>      -+\t\tif {$::tcl_platform(platform) eq {windows}} {\n>      ++\tif {$::tcl_platform(platform) eq {windows}} {\n>       +\t\tset ::answer [encoding convertto utf-8 $::answer]\n>       +\t}\n>       +\n>\n>\n>  git-gui--askpass | 5 +++++\n>  1 file changed, 5 insertions(+)\n>\n> diff --git a/git-gui--askpass b/git-gui--askpass\n> index 4277f30c411..1c99ee8ca20 100755\n> --- a/git-gui--askpass\n> +++ b/git-gui--askpass\n> @@ -56,6 +56,11 @@ proc finish {} {\n>  \t\t}\n>  \t}\n>  \n> +\t# On Windows, force the encoding to UTF-8: it is what `git.exe` expects\n> +\tif {$::tcl_platform(platform) eq {windows}} {\n> +\t\tset ::answer [encoding convertto utf-8 $::answer]\n> +\t}\n> +\n>  \tputs $::answer\n>  \tset ::rc 0\n>  }\n>\n> base-commit: 63a58457e094c9c9bbf562b872009d32f1f88133\n"},{"id":"393250","messageId":"20200314172600.a6nrm7h3pdzshdv2@yadavpratyush.com","threadId":"52979","inReplyTo":"pull.578.v2.git.1584048710895.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] git-gui--askpass: coerce answers to UTF-8 on Windows","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2020-03-14T17:26:00Z","receivedAt":"2020-03-15T02:12:23Z","isPatch":true,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"On 12/03/20 09:31PM, Johannes Schindelin via GitGitGadget wrote:\n> From: Luke Bonanomi <lbonanomi@gmail.com>\n> \n> This addresses the issue where Git for Windows asks the user for a\n> password, no credential helper is available, and then Git fails to pick\n> up non-ASCII characters from the Git GUI helper.\n> \n> This can be verified e.g. via\n> \n> \techo host=http://abc.com |\n> \tgit -c credential.helper= credential fill\n> \n> and then pasting some umlauts.\n> \n> The underlying reason is that Git for Windows tries to communicate using\n> the UTF-8 encoding no matter what the actual current code page is. So\n> let's indulge Git for Windows and do use that encoding.\n> \n> This fixes https://github.com/git-for-windows/git/issues/2215\n> \n> Signed-off-by: Luke Bonanomi <lbonanomi@gmail.com>\n> Helped-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nMerged. Thanks all.\n\n-- \nRegards,\nPratyush Yadav\n"}]}