[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

localization in (s)printf

From: Gilles Duvert
Subject: localization in (s)printf
Date: Tue, 11 Jun 2002 09:33:02 +0200


I would like to let you know of an annoying, possibly fatal, side effect of the 
new standards followed by the (s)printf() family of functions.

After an upgrade to Mandrake 8.2, I have found to my great dismay that the 
family of sprint() C functions would now format floats according to the current 
locale. This is simply crazy. We (astronomers) have tons of programs that 
exchange, sometimes internally, formatted data between C and Fortran. With the 
new GLIBC [glib-config --version says that my version is 1.2.10], a genuine 
%6.2f format will be written with a comma (under locale fr_FR) as separator for 
the fractional part, and the fortran compiled with g77 at the same time will 
look for a dot as separator when trying to read the value . Nothing will work 
anymore (in fact, nothing works anymore!).

I know pretty well that the glibc adhere to new standards and that our problem 
can be solved readily if we enforce the en_EN locale on our machines (the 
supposedlly "portable" POSIX locale does not work according to the 
documentation---a bug??). I find this not desirable at all since it goes 
backwards in terms of internationalization!

Of course I have already solved my problem with an adequate call to 
setlocale(), but I am sure that this new localization feature will break many 
an old trusty code.

Sincerely yours


reply via email to

[Prev in Thread] Current Thread [Next in Thread]