Re: [PATCH] builtin-blame.c: Use utf8_strwidth for author's names
From: Geoffrey Thomas <hidden>
Date: 2016-06-15 22:46:04
Good point (even if your commit message has lines much longer than 72 chars, ASCII ones at that).
Oops; I'll fix that.
But how certain are you at that point that the authors are in UTF-8 format? IOW what encoding conversions were possibly performed up to that point?
I don't believe there are any encoding conversions performed up to that
point. IIRC git doesn't require any encoding but encourages UTF-8; if it's
something obscure, I have no way of knowing how wide in screen columns the
author field is because I likely don't have a library for it in git at
all. I do have a utf8.c, though.
Currently, however, printf("%*.*s", width, width, author) is simply wrong,
because printf only cares about bytes, not screen columns. Do you think I
should fall back on the old behavior if i18n.commitencoding is set, or if
at least one of the author names isn't parseable as UTF-8, or something?
Or should I be doing this with iconv and assuming all commits are
encoded in the current encoding specified via $LANG or $LC_whatever?
--
Geoffrey Thomas
geofft@mit.edu