Red Hat Bugzilla – Bug 6716
strftime(3) does not use LC_TIME or LC_ALL: output always in English
Last modified: 2008-05-01 11:37:52 EDT
When one uses strftime(3) to get a date string formated
according to one's need, locale is not taken into account:
the week day and month name are still in English.
When one strace(1) a process that uses strftime(3), one can
see that no access is done to open locale files.
Examination of the source of strftime in glibc2 shows that
the problem comes probably of a bad configuration of the
GLIBC since strftime.c seems to be able to get locale thru
_NL_CURRENT macro if correctly compiled.
I did not report the bug to FSF/GNU yet because of that.
Example of program showing the bug:
struct tm MyTm;
Run this program with LC_TIME=fr_FR (for instance) and
you'll see still English output.
strace this program and you'll see no file opened to get
Same problem with RedHat 6.1
Thanks for your help.
as far as I know, you have to call setlocale(getenv("LC_ALL")) before you can
use localized functions.
$ export LANG=fr_FR
Thanks guys. Being used to USVR4 where strftime(3) did not need any explicit
call to setlocale(3) before its use, I reported a non-bug ;-(