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

Re: Locale question



On Mon, Nov 22, 1999 at 07:53:53PM +0100, Michael Meskes wrote:
> I never cared much about localization but now I'm stuck with a program that
> works well with all locales but has to do some output without using the
> locale.
> 
> Since the output is a floating point I get e.g. 14,7 instead of 14.7 using
> the german locale. But I need it to output 14.7. So far it uses printf for
> output. Is there a printf-like-function that does not care about locales? Or
> a format string that is locale-independant? Or is the only solution to
> setlocale(LC_ALL, "C") before the printf and setlocale(LC_ALL, "de_DE")
> afterwards?
> 
  You could set LC_NUMERIC="C" so only numbers are changed, but make
  sure LC_ALL is not set and LANG="de_DE". Of course, that'll screw with
  all of your number formats.
-- 
+----------------------------------------------------+
| Eric G. Miller                        egm2@jps.net |
| GnuPG public key: http://www.jps.net/egm2/gpg.asc  |
+----------------------------------------------------+


Reply to: