[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ls - French translation of N_("%b %e %Y")
From: |
Bruno Haible |
Subject: |
Re: ls - French translation of N_("%b %e %Y") |
Date: |
Thu, 19 Mar 2009 12:45:18 +0100 |
User-agent: |
KMail/1.9.9 |
Eric Blake wrote:
> "The results are unspecified ... or if a minimum field width is
> specified for any conversion specifier other than C , F , G , or Y ."
>
> So I guess the gcc warning is nice if you are being portable to non-GNU
> strftime
And also with GNU strftime, the width feature is useless here: %5b will ensure
that the result occupies 5 _bytes_, not 5 screen columns. POSIX says:
"If the converted value ... has fewer bytes than the minimum field width
... the output shall be padded ..."
Bytes and columns are a different thing. For example, in a German UTF-8
locale, "Mär" is 4 bytes but only 3 screen column. Likewise for "fév" in
a French UTF-8 locale.
Test program:
=================================================
#include <stdio.h>
#include <locale.h>
#include <time.h>
int main()
{
setlocale (LC_ALL, "");
char buf[100];
time_t now = time (NULL);
strftime (buf, 100, "%5b", localtime (&now));
printf ("|%s|\n", buf);
return 0;
}
=================================================
$ LC_ALL=fr_FR.UTF-8 ./a.out
| mars|
$ LC_ALL=de_DE.UTF-8 ./a.out
| Mär|
You can see that for column alignment purposes, it is useless.
Bruno
Re: ls - French translation of N_("%b %e %Y"), Paul Eggert, 2009/03/15