Re: [PATCH v2] fetch: align new ref summary printout in UTF-8 locales

2012-09-12 Thread Torsten Bögershausen
On 12.09.12 20:02, Junio C Hamano wrote: > Nguyen Thai Ngoc Duy writes: > >> Ping.. what happens to this patch? Do you want to support other >> encodings as well via iconv()? I can't test that though. > > I thought I refuted a potential blocker, which was an implied > objection from Torsten, in

Re: [PATCH v2] fetch: align new ref summary printout in UTF-8 locales

2012-09-12 Thread Junio C Hamano
Nguyen Thai Ngoc Duy writes: > Ping.. what happens to this patch? Do you want to support other > encodings as well via iconv()? I can't test that though. I thought I refuted a potential blocker, which was an implied objection from Torsten, in $gmane/204912 already. As long as we make it clear t

Re: [PATCH v2] fetch: align new ref summary printout in UTF-8 locales

2012-09-12 Thread Nguyen Thai Ngoc Duy
Ping.. what happens to this patch? Do you want to support other encodings as well via iconv()? I can't test that though. On Tue, Sep 4, 2012 at 5:39 PM, Nguyễn Thái Ngọc Duy wrote: > fetch does printf("%-*s", width, "foo") where "foo" can be a utf-8 > string, but width is in bytes, not columns. F

Re: [PATCH v2] fetch: align new ref summary printout in UTF-8 locales

2012-09-06 Thread Junio C Hamano
Torsten Bögershausen writes: > I try to re-phrase my question: > > Do installations still exist which use e.g. BIG5 or any other > multi byte encoding which is not UTF-8? Yes. > Do we want to support other encodings than ASCII or UTF-8? > (Because then the screen width needs to be calculate dif

Re: [PATCH v2] fetch: align new ref summary printout in UTF-8 locales

2012-09-06 Thread Torsten Bögershausen
Am 06.09.2012 um 17:36 schrieb Nguyen Thai Ngoc Duy: > On Thu, Sep 6, 2012 at 2:20 AM, Torsten Bögershausen wrote: >>> Will that work for non-ASCII encodings? >>> For ISO-8859-x we can say strlen() == strwidth(), >>> but for other encodings using multibytes that doesn't work, does it? > > BTW i

Re: [PATCH v2] fetch: align new ref summary printout in UTF-8 locales

2012-09-06 Thread Nguyen Thai Ngoc Duy
On Thu, Sep 6, 2012 at 2:20 AM, Torsten Bögershausen wrote: >> Will that work for non-ASCII encodings? >> For ISO-8859-x we can say strlen() == strwidth(), >> but for other encodings using multibytes that doesn't work, does it? BTW if you are interested in supporting non-utf8 output, you may want

Re: [PATCH v2] fetch: align new ref summary printout in UTF-8 locales

2012-09-06 Thread Nguyen Thai Ngoc Duy
On Thu, Sep 6, 2012 at 2:20 AM, Torsten Bögershausen wrote: > On 09/05/2012 08:15 PM, Torsten Bögershausen wrote: >> >> On 04.09.12 12:39, Nguyễn Thái Ngọc Duy wrote: >>> >>> +/* return the number of columns of string 's' in current locale */ >>> +int gettext_width(const char *s) >>> +{ >>> +

Re: [PATCH v2] fetch: align new ref summary printout in UTF-8 locales

2012-09-05 Thread Torsten Bögershausen
On 09/05/2012 08:15 PM, Torsten Bögershausen wrote: On 04.09.12 12:39, Nguyễn Thái Ngọc Duy wrote: +/* return the number of columns of string 's' in current locale */ +int gettext_width(const char *s) +{ + static int is_utf8 = -1; + if (is_utf8 == -1) + is_utf8 = !strcm

[PATCH v2] fetch: align new ref summary printout in UTF-8 locales

2012-09-04 Thread Nguyễn Thái Ngọc Duy
fetch does printf("%-*s", width, "foo") where "foo" can be a utf-8 string, but width is in bytes, not columns. For ASCII it's fine as one byte takes one column. For utf-8, this may result in misaligned ref summary table. Introduce gettext_width() function that returns the string length in columns