{"thread":{"id":"11256","subject":"git gui blame utf-8 bugs","startedAt":"2007-12-12T09:17:44Z","lastAt":"2007-12-17T07:50:51Z","messageCount":4,"participants":["Finn Arne Gangstad","Shawn O. Pearce","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"62880","messageId":"20071212091744.GA5377@pvv.org","threadId":"11256","inReplyTo":null,"subject":"git gui blame utf-8 bugs","fromName":"Finn Arne Gangstad","fromEmail":"finnag@pvv.org","sentAt":"2007-12-12T09:17:44Z","receivedAt":"2007-12-12T09:17:44Z","isPatch":false,"sender":{"key":"finnag@pvv.org","avatar":"https://gravatar.com/avatar/b421ddd58c3f0f93aa473e17b98bb8d53c221fef741746bc8cb59fae4ec6d95e?d=mp&s=160"},"body":"git gui has some utf-8 bugs:\n\nIf you do git gui blame <file>, and the file contains utf-8 text,\nthe lines are not parsed as utf-8, but seemingly as iso-8859-1 instead.\n\nAlso, the hovering comment is INITIALLY shown garbled (both Author and\ncommit message), but if you click on a line, so that the commit\nmessage is shown in the bottom window, the hovering message is\nmagically corrected to utf-8.\n\nThe text in the lower window (showing specific commits) seems to\nalways be handled correctly.\n\nTo reproduce: Set your author name to include some utf-8 tokens, add a\nline with some utf-8 tokens to a file, commit it with a commit message\nincluding some utf-8 tokens, and do git gui blame on the file. The\nline will be garbled in the top window, and the hovering message will\nbe garbled until you click on the line.\n\nVerified with git-gui.git master\n\n- Finn Arne\n"},{"id":"63111","messageId":"20071214064709.GH14735@spearce.org","threadId":"11256","inReplyTo":"20071212091744.GA5377@pvv.org","subject":"Re: git gui blame utf-8 bugs","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-12-14T06:47:09Z","receivedAt":"2007-12-14T06:47:09Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Finn Arne Gangstad <finnag@pvv.org> wrote:\n> git gui has some utf-8 bugs:\n\nIt has several.  :-)\n \n> If you do git gui blame <file>, and the file contains utf-8 text,\n> the lines are not parsed as utf-8, but seemingly as iso-8859-1 instead.\n\nRight.  git-gui is keying off the environment setting for LANG, so I\nguess its set to iso-8859-1 on your system but you are working with a\nutf-8 file.  We've talked about using something like .gitattributes\nto store encoding hints, or to just put a global gui setting in\n~/.gitconfig but neither has had any patches written for it.\n\nUTF-8 is seemingly the most common encoding that git-gui is mangling\nso maybe we should be defaulting to utf-8 until someone codes a\nmore intelligent patch.\n\n> Also, the hovering comment is INITIALLY shown garbled (both Author and\n> commit message), but if you click on a line, so that the commit\n> message is shown in the bottom window, the hovering message is\n> magically corrected to utf-8.\n> \n> The text in the lower window (showing specific commits) seems to\n> always be handled correctly.\n\nThat's a \"feature\".  :-)\n\nWhat's happening here is the initial hovering message is obtained\nfrom the machine formatted output from `git blame --incremental`\nand in that format there is no encoding header so I'm just ignoring\nany encoding problems.\n\nLater when you click on a line it does `git cat-file commit $sha1`\nand gets the proper encoding, and corrects the strings it originally\nhad gotten from git-blame.  So the hovering message \"fixes\" itself\nlater on.\n\nMaybe here too we should be defaulting to utf-8 instead of the\nnative encoding.\n\n-- \nShawn.\n"},{"id":"63160","messageId":"m3k5nhqwkn.fsf@roke.D-201","threadId":"11256","inReplyTo":"20071214064709.GH14735@spearce.org","subject":"Re: git gui blame utf-8 bugs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-12-14T12:39:59Z","receivedAt":"2007-12-14T12:39:59Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> Finn Arne Gangstad <finnag@pvv.org> wrote:\n> > git gui has some utf-8 bugs:\n> \n> It has several.  :-)\n>  \n> > If you do git gui blame <file>, and the file contains utf-8 text,\n> > the lines are not parsed as utf-8, but seemingly as iso-8859-1 instead.\n> \n> Right.  git-gui is keying off the environment setting for LANG, so I\n> guess its set to iso-8859-1 on your system but you are working with a\n> utf-8 file.  We've talked about using something like .gitattributes\n> to store encoding hints, or to just put a global gui setting in\n> ~/.gitconfig but neither has had any patches written for it.\n> \n> UTF-8 is seemingly the most common encoding that git-gui is mangling\n> so maybe we should be defaulting to utf-8 until someone codes a\n> more intelligent patch.\n\nCurrently there is no config variable for default encoding of file\ncontents (of blobs) and of filenames (of trees) because those do not\nmatter for core git.  But they do matter for GUI.\n \n> > Also, the hovering comment is INITIALLY shown garbled (both Author and\n> > commit message), but if you click on a line, so that the commit\n> > message is shown in the bottom window, the hovering message is\n> > magically corrected to utf-8.\n> > \n> > The text in the lower window (showing specific commits) seems to\n> > always be handled correctly.\n> \n> That's a \"feature\".  :-)\n> \n> What's happening here is the initial hovering message is obtained\n> from the machine formatted output from `git blame --incremental`\n> and in that format there is no encoding header so I'm just ignoring\n> any encoding problems.\n\nSo the correct solution would be to enhance \"git blame --incremental\"\nto output 'encoding' header when needed (when commit has encoding\nheader and it is different from log output encoding).\n\n> Later when you click on a line it does `git cat-file commit $sha1`\n> and gets the proper encoding, and corrects the strings it originally\n> had gotten from git-blame.  So the hovering message \"fixes\" itself\n> later on.\n> \n> Maybe here too we should be defaulting to utf-8 instead of the\n> native encoding.\n\nI think this is a good idea, as git repositories are meant to be\ncross-operating system (which means cross-delault-encodings)\ncompatible.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"63373","messageId":"20071217075050.GA9927@pvv.org","threadId":"11256","inReplyTo":"m3k5nhqwkn.fsf@roke.D-201","subject":"Re: git gui blame utf-8 bugs","fromName":"Finn Arne Gangstad","fromEmail":"finnag@pvv.org","sentAt":"2007-12-17T07:50:51Z","receivedAt":"2007-12-17T07:50:51Z","isPatch":false,"sender":{"key":"finnag@pvv.org","avatar":"https://gravatar.com/avatar/b421ddd58c3f0f93aa473e17b98bb8d53c221fef741746bc8cb59fae4ec6d95e?d=mp&s=160"},"body":"On Fri, Dec 14, 2007 at 04:39:59AM -0800, Jakub Narebski wrote:\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> \n> > Finn Arne Gangstad <finnag@pvv.org> wrote:\n> > > git gui has some utf-8 bugs:\n> > \n> > It has several.  :-)\n> >  \n> > > If you do git gui blame <file>, and the file contains utf-8 text,\n> > > the lines are not parsed as utf-8, but seemingly as iso-8859-1 instead.\n> > \n> > Right.  git-gui is keying off the environment setting for LANG, so I\n> > guess its set to iso-8859-1 on your system but you are working with a\n> > [...]\n\nSetting LANG does not seem to have any effect at all (neiher for file\ncontents, aurhor or commit messages).\n\nLANG=en_US.UTF-8 git gui blame dir.c -> same\nLANG=utf-8 git gui blame dir.c -> same\n\n- Finn Arne\n"}]}