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

Re: [PATCH] builtin-blame.c: Use utf8_strwidth for author's names

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 3, 2009, 04:30 UTC
Message-ID
<7vd4e0f8gp.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.DEB.1.00.0902021326420.3586@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> And last time I checked, many more encodings used 1 character/byte (or for 
> that matter, 1 column / byte) than not; utf8_width would be "more wrong" 
> than strlen() here, because strlen() would "happen to work" here.

Ahh, you are absolutely right here, and use of utf8_width without checking is actively breaking things.

Show 5 quoted lines
> There _has_ to be a way to check if the current author string is encoded 
> in UTF-8.  All I am asking is that the original poster would put just a 
> _little_ more effort into the issue and make the thing dependent on the 
> knowledge -- as opposed to the assumption -- that the author is encoded in 
> UTF-8.
Yeah, that makes sense.
Show 7 quoted lines
> That is the code that barfs in wcwidth:
>
>         if (ch < 32 || (ch >= 0x7f && ch < 0xa0))
>                 return -1;
>
> That is not a big problem, but Geoff's code does not handle that case 
> correctly.

Thanks for checking --- I suspected something like that would be there somewhere.

Previous: Johannes SchindelinNext: Jeff King
Message 9 of 13 in “utf8: add utf8_strwidth()”
  1. utf8: add utf8_strwidth()Geoffrey Thomas, Jan 30, 2009
  2. builtin-blame.c: Use utf8_strwidth for author's namesGeoffrey Thomas, Jan 30, 2009
  3. Johannes SchindelinJan 30, 2009
  4. Geoffrey ThomasJan 30, 2009
  5. Jeff KingJan 31, 2009
  6. Johannes SchindelinFeb 1, 2009
  7. Junio C HamanoFeb 2, 2009
  8. Johannes SchindelinFeb 2, 2009
  9. Junio C HamanoFeb 3, 2009
  10. Jeff KingFeb 2, 2009
  11. Jeff KingJan 31, 2009
  12. Geoffrey ThomasJan 31, 2009
  13. Jeff KingJan 31, 2009

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.