[Top][All Lists]

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

Re: localization in (s)printf

From: Andreas Jaeger
Subject: Re: localization in (s)printf
Date: Wed, 12 Jun 2002 22:27:56 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.4 (Artificial Intelligence, i386-suse-linux)

Gilles Duvert <address@hidden> writes:

> Sirs,
> 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

glib != glibc!

> %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!).

Set one of the LC_* environment variables that change this, they're
explained in the glibc manual.


> 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!

POSIX works, check your settings with locale.

> 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.

glibc follows the existing standards.  If you do not want
localization, you should not set LC_* or LANG in your environment.

 Andreas Jaeger
  SuSE Labs address@hidden
   private address@hidden

reply via email to

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