Re: setlocale portability


Subject: Re: setlocale portability
From: Vlad Harchev (hvv@hippo.ru)
Date: Mon Apr 02 2001 - 07:58:02 CDT


On Mon, 2 Apr 2001, Hubert Figuiere wrote:

 Hi,

> Joaquin Cuenca Abela écrit:
>
> >> My question is how portable is setlocale() to revert locale back to "C" when
> >> writting the file ? Because setlocale() can be the solution to the problem.
> >
> > I don't know, but I remember that the same problem was raised once upon
> > a time when we were writting colors in the .ps file (I think that a
> > portugues dude solved the problem).
>
> The fix is like mine: surround sprintf(%f) with setlocale() call to use C
> locale. This fix is in UNIX code.
> This time the problem arise in XP code. That's why I'm wondering about
> portabibility outside UNIX code. setlocale() is supposed to be part of
> POSIX, but some platform may not support it. Perhaps I should write a UT
> wrapper for this.

 Yes, having a wrapper would be convenient.
 Grepping over source tree it turns out that most of platforms we support
do support setlocale (unix, beos, qnx) - so we need a wrapper that will do
nothing of win32 and call setlocale on other platforms..

> I'm about to check my fix on Linux/GNOME. This is a 3 LOC fix.
>
>
> Hub
>

 Best regards,
  -Vlad



This archive was generated by hypermail 2b25 : Mon Apr 02 2001 - 08:39:18 CDT