On Thu, 27 Nov 2014 21:02:16 +0400 Zura Khetsuriani wrote:
ZK> I think I've found the bug:
ZK>
ZK> wxNumberFormatter::GetDecimalSeparator caches the separator (be it dot
ZK> or comma) in the static variable. And it only updates it if
ZK> LocaleId::NotInitializedOrHasChanged returns true.
ZK>
ZK> BUT, this LocaleId::NotInitializedOrHasChanged only checks for LC_ALL
ZK> change, thus I suppose the change of only LC_NUMERIC is ignored.
This would be a bug in OS X setlocale() behaviour -- not that I'd be
really surprised by it, CRT under OS X is amazingly broken. Still, it would
be nice to confirm this, so could you please compile the following program:
---------------------------------- >8 --------------------------------------
#include <locale.h>
#include <stdio.h>
#include <langinfo.h>
int main(int argc, char **argv)
{
if ( argc != 2 ) {
fprintf(stderr, "Usage: %s <locale>\n", argv[0]);
return 1;
}
printf("LC_ALL=%s\nLC_NUM=%s\n", setlocale(LC_ALL, NULL), setlocale(LC_NUMERIC, NULL));
if ( !setlocale(LC_ALL, argv[1]) ) {
fprintf(stderr, "Locale %s is not supported by this system.\n", argv[1]);
return 2;
}
printf("LC_ALL=%s\nLC_NUM=%s\n", setlocale(LC_ALL, NULL), setlocale(LC_NUMERIC, NULL));
setlocale(LC_NUMERIC, "C");
printf("LC_ALL=%s\nLC_NUM=%s\n", setlocale(LC_ALL, NULL), setlocale(LC_NUMERIC, NULL));
return 0;
}
---------------------------------- >8 --------------------------------------
and run it with some locale your system supports?
Here is what it outputs for me under Linux, for example:
% ./a.out fr_FR
LC_ALL=C
LC_NUM=C
LC_ALL=fr_FR
LC_NUM=fr_FR
LC_ALL=LC_CTYPE=fr_FR;LC_NUMERIC=C;LC_TIME=fr_FR;LC_COLLATE=fr_FR;LC_MONETARY=fr_FR;LC_MESSAGES=fr_FR;LC_PAPER=fr_FR;LC_NAME=fr_FR;LC_ADDRESS=fr_FR;LC_TELEPHONE=fr_FR;LC_MEASUREMENT=fr_FR;LC_IDENTIFICATION=fr_FR
LC_NUM=C
As you can see, calling setlocale(LC_NUMERIC) does change the value
returned from setlocale(LC_ALL, NULL). Is this really not the case under OS
X?
Also, it looks like checking for LC_NUMERIC instead of LC_ALL in wx code
should fix the problem if you're correct, could you please try if it does?
Thanks,