From: Sergey Vlasov Date: Wed, 08 Mar 2006 14:32:49 GMT Subject: Re: [PATCH] git-blame: Make the output human readable Message-ID: <20060308173249.1faed1d7.vsu@altlinux.ru> In-Reply-To: <20060306193326.19262.qmail@science.horizon.com> On 6 Mar 2006 14:33:26 -0500 linux@horizon.com wrote: > Well, getting 15 characters in UTF-8 is easy (just stop before the 16th > byte for which ((b & 0xc0) != 0x80)), but what about combining characters? > > You've got accents and stuff to worry about. And the annoying fact that > Unicode defined accents as suffixes, so you have to go past the 15th > column to include all of the > > And then there's that fact that many characters are traditionally > represented as double-wide forms, even on character terminals. > > See http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c for details > an an example implementation of wcwidth(). > [skip] > /* Now find the width of it */ > w = wcwidth(c); And this won't work, unless you also add that wcwidth() implementation to git. The problem is that the wchar_t encoding is not specified anywhere - glibc uses Unicode for it, but other systems can use whatever they want (even locale-dependent).