← Back to team overview

kicad-developers team mailing list archive

Broken setlocale in sim/ngspice.cpp

 

Hi Orson,

When receiving the changes in rev 7033, I saw you are using in many places in ngspice.cpp (and
perhaps in other files):
setlocale( LC_ALL, "C" );
and then
setlocale( LC_ALL, "" );

Unfortunately it is broken.
We have already encountered issues with this kind of code.
*Do not use it*.

Please, use only to temporary set the "C3 locale:
LOCALE_IO dummy;

The reason is setlocale( LC_ALL, "" ); switches the locale to the system locale, not the previously
set locale.
It creates serious issues if the previous locale or the Kicad locale is not the system locale.
(For instance if you are using inside Kicad an other language than the default)

It creates serious issues especially when the system fp separator is the comma instead of the point.
Usually the floating point validators in dialogs become broken and fp values can be no more entered.
And these issues are not easy to fix (I spent time to understand what happened and to fix that issue)

Thanks.

-- 
Jean-Pierre CHARRAS


Follow ups