Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:05

Johannes Schindelin [off-list ref] 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.
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.
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help