# [PATCH] git-gui: Prevent double UTF-8 conversion

2 messages from 2017-08-21 to 2017-08-21. Participants: Łukasz Stelmach, Stefan Beller.
Thread: https://gitlist.dev/t/46640

## Łukasz Stelmach, 2017-08-21 11:53

Subject: [PATCH] git-gui: Prevent double UTF-8 conversion
Message-ID: <20170821115313.11879-1-l.stelmach@samsung.com>
URL: https://gitlist.dev/e/20170821115313.11879-1-l.stelmach%40samsung.com
In-Reply-To: <CGME20170821115329eucas1p1c550891b502863669ca351de028f2b80@eucas1p1.samsung.com>

```
With encoding on the file descriptor set to "binary" Tcl (8.6 in my case)
does double conversion which breaks e.g. author name in amended commits.

For example "\305\201ukasz" (as written by git cat-file) becomes
"\303\205\302\201ukasz".

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
---
 git-gui/lib/commit.tcl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
index 83620b7cb..bcb6499a0 100644
--- a/git-gui/lib/commit.tcl
+++ b/git-gui/lib/commit.tcl
@@ -26,7 +26,7 @@ You are currently in the middle of a merge that has not been fully completed.  Y
 	set parents [list]
 	if {[catch {
 			set fd [git_read cat-file commit $curHEAD]
-			fconfigure $fd -encoding binary -translation lf
+			fconfigure $fd -encoding utf-8 -translation lf
 			# By default commits are assumed to be in utf-8
 			set enc utf-8
 			while {[gets $fd line] > 0} {
-- 
2.11.0


```

## Stefan Beller, 2017-08-21 18:52

Subject: Re: [PATCH] git-gui: Prevent double UTF-8 conversion
Message-ID: <CAGZ79kZ7s8Y0M=5g8skhcONo=r9Y+MiHp3=+E1JTL4zNE_4v+g@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kZ7s8Y0M%3D5g8skhcONo%3Dr9Y%2BMiHp3%3D%2BE1JTL4zNE_4v%2Bg%40mail.gmail.com
In-Reply-To: <20170821115313.11879-1-l.stelmach@samsung.com>

```
+cc git gui maintainer

On Mon, Aug 21, 2017 at 4:53 AM, Łukasz Stelmach <l.stelmach@samsung.com> wrote:
> With encoding on the file descriptor set to "binary" Tcl (8.6 in my case)
> does double conversion which breaks e.g. author name in amended commits.
>
> For example "\305\201ukasz" (as written by git cat-file) becomes
> "\303\205\302\201ukasz".
>
> Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
> ---
>  git-gui/lib/commit.tcl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
> index 83620b7cb..bcb6499a0 100644
> --- a/git-gui/lib/commit.tcl
> +++ b/git-gui/lib/commit.tcl
> @@ -26,7 +26,7 @@ You are currently in the middle of a merge that has not been fully completed.  Y
>         set parents [list]
>         if {[catch {
>                         set fd [git_read cat-file commit $curHEAD]
> -                       fconfigure $fd -encoding binary -translation lf
> +                       fconfigure $fd -encoding utf-8 -translation lf
>                         # By default commits are assumed to be in utf-8
>                         set enc utf-8
>                         while {[gets $fd line] > 0} {
> --
> 2.11.0
>

```
