Re: decimal separator

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

 



On Mon, 2006-01-23 at 11:56 +0100, Olivier Pierard wrote:
> On one computer, the same gtk program considers the decimal separator as 
> a coma, on the other one as a point.  Obviously, this is linked to 
> regional settings (there is a call to gtk_set_locale in gtk_main() if I 
> understand well).  What's more surprising is that on both computers, my 
> regional settings on KDE are set to a point as decimal separator (but 
> during the first instalation, local parameters were belgian ones - and 
> coma separator-, which should be the source of the problem).  So the 
> call to gtk_set_locale should read the information in another file than 
> the settings of KDE, but which one ?
> 
> Maybe, the solution (but not the nicest !) should be to call 
> gtk_disable_set_locale but how to know which ones will be the 'default' 
> parameters.

Here is how I deal with this problem in my program :

use POSIX qw/locale_h/;

# code that don't care what the decimal separator is
setlocale(LC_NUMERIC, 'C');
# code that needs the decimal separator to be '.'
setlocale(LC_NUMERIC, '');
# code that don't care what the decimal separator is

Let me know if there is a better way.


Quentin

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux