git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: fix branch name encoding error on gitk

From
加藤一博 <kato-k@ksysllc.co.jp>
Date
Dec 7, 2019, 00:32 UTC
Message-ID
<20191207003203.9612-1-kato-k@ksysllc.co.jp>
From: Kazuhiro Kato <kazuhiro.kato@hotmail.co.jp>

After "git checkout -b '漢字'" to create a branch with UTF-8 character in it, "gitk" shows the branch name incorrectly, as it forgets to turn the bytes read from the "git show-ref" command into Unicode characters.

Signed-off-by: Kazuhiro Kato <kato-k@ksysllc.co.jp>
---
 gitk | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/gitk b/gitk
index abe4805..3f61a5b 100755
--- a/gitk
+++ b/gitk
@@ -1780,11 +1780,15 @@ proc readrefs {} {
     global otherrefids idotherrefs mainhead mainheadid
     global selecthead selectheadid
     global hideremotes
+    global tclencoding
 
     foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
 	unset -nocomplain $v
     }
     set refd [open [list | git show-ref -d] r]
+    if {$tclencoding != {}} {
+	fconfigure $refd -encoding $tclencoding
+    }
     while {[gets $refd line] >= 0} {
 	if {[string index $line 40] ne " "} continue
 	set id [string range $line 0 39]
-- 
2.20.1.windows.1
Next: Junio C Hamano
Message 1 of 3 in “gitk: fix branch name encoding error on gitk”
  1. gitk: fix branch name encoding error on gitk加藤一博, Dec 7, 2019
  2. Junio C HamanoDec 9, 2019
  3. Paul MackerrasDec 15, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.