discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Localization of libc and number handling


From: Alexander Malmberg
Subject: Re: Localization of libc and number handling
Date: Mon, 23 Jun 2003 14:20:28 +0200

Andreas Heppel wrote:
> 
> Hi folks,
> I again bumped into a Problem having to do with localization of libc and
> resulting from this problems with GNUstep.
> I happened to have a problem with the sliders in GWorkspace's Desktop prefs.
> The either had the value 0 or 1, but nothing inbetween. Tracking this down, I
> found out, that it had to do with the way, the libc handles floats. As I am
> using a German locale (LANG=de), all libc functions handling floats (e.g.
> atof()) expect a decimal comma instead of a point. Unfortunately, [NSNumber
> -description] uses a locale value of 'nil', resulting in a string
> representation containing a decimal _point_. This makes atof return 0 as the
> point is not a valid character in a "German numeric string".

I'm not sure you should rely on being able to parse what -description
returns, but I think its behavior is correct. From what I've seen, all
methods that deal with locale and don't have an explicit locale argument
use the nil/default/c locale, so I'd expect -description to do this as
well.

> The question is, how can a consistent handling of locales between GNUstep and
> the libc be achieved?

It can't. GNUstep can't change the locale or rely on it having any safe
values. I'd suggest either using only libc functions (which means that
you get to manage the libc locale yourself), or using only GNUstep
methods (which are supposed to use the OpenStep locale handling, but see
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=3519&group_id=99 ).

- Alexander Malmberg




reply via email to

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