Hi,
I just noticed an annoying issue with locales in PHP and I'm not sure if this behaviour is intended or it's a bug.
I'm doing the following:
setlocale(LC_ALL, 'de_DE'); $l = localeconv(); printf("Decimal point: %s\n", $l['decimal_point']); printf("Thousands sep: %s\n", $l['thousands_sep']);
This should output a "," as decimal point and a "." as thousands separator but it does only output the standard characters (A dot as decimal point and nothing as thousands_sep).
My de_DE locale is properly set up. All other data returned by localeconv is correct (EUR currency, Euro currency symbol, monetary decimal point and monetary thousand separator and so on). Only the decimal_point and thousands_sep is not working.
Also interesting is that printf("%.2f", 123.45) correctly outputs "123,45". So PHP IS using a comma as decimal point but why does it not show up in localeconv()?
I tried exactly the same code in C on the same machine and this is working perfectly:
#include <locale.h> int main(int argc, char *argv[]) { struct lconv *l; setlocale(LC_ALL, "de_DE"); l = localeconv(); printf("Decimal point: %s\n", l->decimal_point); printf("Thousands sep: %s\n", l->thousands_sep); return 0; }
This outputs correct german decimal point and thousands separator.
Is there a reason for this misbehaviour of PHP? Or is it a bug? I encounter this with PHP 5.0.2 and 4.3.9.
-- Bye, K <http://www.ailis.de/~k/> (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger k@xxxxxxxx to get public key)
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php