{"thread":{"id":"2658","subject":"[PATCH] gitk: UTF-8 support","startedAt":"2005-11-23T04:15:01Z","lastAt":"2005-11-28T21:55:58Z","messageCount":8,"participants":["Pavel Roskin","Junio C Hamano","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"12592","messageId":"1132719301.12227.5.camel@dv","threadId":"2658","inReplyTo":null,"subject":"[PATCH] gitk: UTF-8 support","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-11-23T04:15:01Z","receivedAt":"2005-11-23T04:15:01Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Add gitencoding variable and set it to \"utf-8\".  Use it for converting\ngit-rev-list output.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\ndiff --git a/gitk b/gitk\nindex 3dd97e2..e53b609 100755\n--- a/gitk\n+++ b/gitk\n@@ -19,7 +19,7 @@ proc gitdir {} {\n proc getcommits {rargs} {\n     global commits commfd phase canv mainfont env\n     global startmsecs nextupdate ncmupdate\n-    global ctext maincursor textcursor leftover\n+    global ctext maincursor textcursor leftover gitencoding\n \n     # check that we can find a .git directory somewhere...\n     set gitdir [gitdir]\n@@ -49,7 +49,7 @@ proc getcommits {rargs} {\n \texit 1\n     }\n     set leftover {}\n-    fconfigure $commfd -blocking 0 -translation lf\n+    fconfigure $commfd -blocking 0 -translation lf -encoding $gitencoding\n     fileevent $commfd readable [list getcommitlines $commfd]\n     $canv delete all\n     $canv create text 3 3 -anchor nw -text \"Reading commits...\" \\\n@@ -3657,6 +3657,7 @@ set datemode 0\n set boldnames 0\n set diffopts \"-U 5 -p\"\n set wrcomcmd \"git-diff-tree --stdin -p --pretty\"\n+set gitencoding \"utf-8\"\n \n set mainfont {Helvetica 9}\n set textfont {Courier 9}\n\n\n-- \nRegards,\nPavel Roskin\n"},{"id":"12656","messageId":"7v64qi50sw.fsf@assigned-by-dhcp.cox.net","threadId":"2658","inReplyTo":"1132719301.12227.5.camel@dv","subject":"Re: [PATCH] gitk: UTF-8 support","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-24T00:47:43Z","receivedAt":"2005-11-24T00:47:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pavel Roskin <proski@gnu.org> writes:\n\n> Add gitencoding variable and set it to \"utf-8\".  Use it for converting\n> git-rev-list output.\n\nSounds good, but is it necessary?  Unless I am grossly mistaken,\nI am opposed to this patch.\n\nWhen I run gitk with LANG and/or LC_CTYPE set to ja_JP.utf8 (I\nsuspect *whatever*.utf8 would work the same way) on git.git\nrepository, I see Lukas's name (originally in iso8859-1 but my\ncommit objects have it in utf8) and Yoshifuji-san's name\n(iso2022 converted to utf8) just fine.\n\nAnd when I run gitk with LANG and/or LC_CTYPE set to ja_JP.ujis\n(that is another name for EUC-JP) on a toy repository I have\ncommit log messages in EUC-JP (I am not recommending that, just\npointing out a possibility), I can see them just fine.  In that\ntest repository, setting locale to *.utf8 would not work.\n\nSo I suspect your change breaks projects that use local\nencodings, without fixing or adding anything new.\n"},{"id":"12659","messageId":"17285.4930.8327.140889@cargo.ozlabs.ibm.com","threadId":"2658","inReplyTo":"7v64qi50sw.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitk: UTF-8 support","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2005-11-24T01:11:30Z","receivedAt":"2005-11-24T01:11:30Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Junio C Hamano writes:\n\n> Pavel Roskin <proski@gnu.org> writes:\n> \n> > Add gitencoding variable and set it to \"utf-8\".  Use it for converting\n> > git-rev-list output.\n> \n> Sounds good, but is it necessary?  Unless I am grossly mistaken,\n> I am opposed to this patch.\n\nI already put this into my gitk.git repository, so you might want to\nhold off pulling that into git.git until we work this out.\n\nBeing clueless about i18n and locales, I tend to just take whatever\npeople tell me is needed in that area. :)\n\nRegards,\nPaul.\n"},{"id":"12664","messageId":"20051123235315.oht0zjidc4ccg8gs@webmail.spamcop.net","threadId":"2658","inReplyTo":"7v64qi50sw.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitk: UTF-8 support","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-11-24T04:53:15Z","receivedAt":"2005-11-24T04:53:15Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Hello!\n\nQuoting Junio C Hamano <junkio@cox.net>:\n\n> Pavel Roskin <proski@gnu.org> writes:\n>\n> > Add gitencoding variable and set it to \"utf-8\".  Use it for converting\n> > git-rev-list output.\n>\n> Sounds good, but is it necessary?  Unless I am grossly mistaken,\n> I am opposed to this patch.\n>\n> When I run gitk with LANG and/or LC_CTYPE set to ja_JP.utf8 (I\n> suspect *whatever*.utf8 would work the same way) on git.git\n> repository, I see Lukas's name (originally in iso8859-1 but my\n> commit objects have it in utf8) and Yoshifuji-san's name\n> (iso2022 converted to utf8) just fine.\n\nI see.  I always use C locale.\n\n> And when I run gitk with LANG and/or LC_CTYPE set to ja_JP.ujis\n> (that is another name for EUC-JP) on a toy repository I have\n> commit log messages in EUC-JP (I am not recommending that, just\n> pointing out a possibility), I can see them just fine.  In that\n> test repository, setting locale to *.utf8 would not work.\n\nThen what would you do to work with a repository using utf-8 if the current\nlocale is not utf-8?\n\n> So I suspect your change breaks projects that use local\n> encodings, without fixing or adding anything new.\n\nI'll be away from any sane OS until Monday, but I assume my patch should help\nthose whose locale is set to an encoding other than utf-8 if they want to use a\nrepository using utf-8.\n\nAnyway, I see your point.  Not ever git repository uses utf-8.  It is not\nenforced by git.\n\nSo we have two solutions.  One is to enforce utf-8 locale in git and force all\n\"offenders\" to convert.  That's probably too intrusive for now.\n\nThe other solution is to have a publicly available file under .git that would\nkeep the encoding name for the metadata (user names, logs etc).  gitk could use\nthat file now.  git could implement conversions a bit later.  Maybe git could\nwarn about mismatching encoding as the first step.\n\n--\nRegards,\nPavel Roskin\n"},{"id":"12669","messageId":"7v1x16y36r.fsf@assigned-by-dhcp.cox.net","threadId":"2658","inReplyTo":"20051123235315.oht0zjidc4ccg8gs@webmail.spamcop.net","subject":"Re: [PATCH] gitk: UTF-8 support","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-24T06:23:24Z","receivedAt":"2005-11-24T06:23:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pavel Roskin <proski@gnu.org> writes:\n\n> Then what would you do to work with a repository using utf-8 if the current\n> locale is not utf-8?\n\nObviously the same way as I did to try things out:\n\n\t$ LANG=en_US.utf8 DISPLAY=:0 gitk blah\n\n> Anyway, I see your point.  Not ever git repository uses utf-8.  It is not\n> enforced by git.\n\nThat is not the point.  Point is that I think the user can use\nLANG and LC_ALL (I suspect LC_CTYPE is what matters) to get what\nyou want, and I suspect hardcoding utf8 robs users the\npossibility to deal with a repository that uses something else.\n\nAnd as I suggested in another message (in the died-out thread\nabout gitweb), we could have i18n.commitEncoding in the\nconfiguration to help gitk and gitweb.  I think that is the same\nas your \"other option\".\n"},{"id":"12670","messageId":"20051124021231.nrg8448gk8w4owk8@webmail.spamcop.net","threadId":"2658","inReplyTo":"7v1x16y36r.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitk: UTF-8 support","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-11-24T07:12:31Z","receivedAt":"2005-11-24T07:12:31Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Quoting Junio C Hamano <junkio@cox.net>:\n\n> That is not the point.  Point is that I think the user can use\n> LANG and LC_ALL (I suspect LC_CTYPE is what matters) to get what\n> you want, and I suspect hardcoding utf8 robs users the\n> possibility to deal with a repository that uses something else.\n\nNot to argue with you, but it's worth pointing out that git is heavily multiuser\nsoftware, and interoperability should not be ranked below local configurability.\n\n> And as I suggested in another message (in the died-out thread\n> about gitweb), we could have i18n.commitEncoding in the\n> configuration to help gitk and gitweb.  I think that is the same\n> as your \"other option\".\n\nYes.  Then my patch needs to be changed to set encoding to that setting and only\nif it's present.\n\n--\nRegards,\nPavel Roskin\n"},{"id":"12826","messageId":"7vr7917hq4.fsf@assigned-by-dhcp.cox.net","threadId":"2658","inReplyTo":"20051124021231.nrg8448gk8w4owk8@webmail.spamcop.net","subject":"Re: [PATCH] gitk: UTF-8 support","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-28T00:12:51Z","receivedAt":"2005-11-28T00:12:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pavel Roskin <proski@gnu.org> writes:\n\n>> And as I suggested in another message (in the died-out thread\n>> about gitweb), we could have i18n.commitEncoding in the\n>> configuration to help gitk and gitweb.  I think that is the same\n>> as your \"other option\".\n>\n> Yes.  Then my patch needs to be changed to set encoding to that setting and only\n> if it's present.\n\nThe following patch on top of your patch has seen only very\nlight testing, but it seems to do the right thing for my\nrepository with utf-8 commit messages and another with euc-jp\ncommit messages.  For the latter, I needed to do:\n\n\t$ git-repo-config i18n.commitencoding euc-jp\n\n-- >8 --\n[PATCH] gitk: Use i18n.commitencoding configuration item.\n\nHardcoding \"utf-8\" in the script breaks projects that use local\nencoding, so allow setting i18n.commitEncoding.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\ndiff --git a/gitk b/gitk\nindex b53a5c5..2242216 100755\n--- a/gitk\n+++ b/gitk\n@@ -3669,7 +3669,14 @@ set datemode 0\n set boldnames 0\n set diffopts \"-U 5 -p\"\n set wrcomcmd \"git-diff-tree --stdin -p --pretty\"\n-set gitencoding \"utf-8\"\n+\n+set gitencoding \"\"\n+catch {\n+    set gitencoding [exec git-repo-config --get i18n.commitencoding]\n+}\n+if {$gitencoding == \"\"} {\n+\tset gitencoding \"utf-8\"\n+}\n \n set mainfont {Helvetica 9}\n set textfont {Courier 9}\n"},{"id":"12897","messageId":"1133214958.27750.8.camel@dv","threadId":"2658","inReplyTo":"7vr7917hq4.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitk: UTF-8 support","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-11-28T21:55:58Z","receivedAt":"2005-11-28T21:55:58Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"On Sun, 2005-11-27 at 16:12 -0800, Junio C Hamano wrote:\n> The following patch on top of your patch has seen only very\n> light testing, but it seems to do the right thing for my\n> repository with utf-8 commit messages and another with euc-jp\n> commit messages.  For the latter, I needed to do:\n> \n> \t$ git-repo-config i18n.commitencoding euc-jp\n\nThank you!  I'm glad my code was actually useful.\n\nNow we may want to make git recode commit data to the repository\nencoding.  Lots of iconv/glibc/portability fun on the horizon.  At very\nleast git should protest if both i18n.commitencoding and the locale\nencoding are set to different values.\n\nAnother issue is support for non-ASCII characters in the filenames.\n\n-- \nRegards,\nPavel Roskin\n"}]}