#28057 [Ana]: nl_langinfo returns wrong data for de_DE

From: Date: Mon, 19 Apr 2004 13:38:53 +0000
Subject: #28057 [Ana]: nl_langinfo returns wrong data for de_DE
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-58379@lists.php.net to get a copy of this message
ID: 28057 User updated by: bublavas at ecetra dot com Reported By: bublavas at ecetra dot com Status: Analyzed Bug Type: Strings related Operating System: 2.4.21-9.EL GNU/Linux PHP Version: 4.3.6 New Comment: Hmm, shouldn't this hack be in serialize() then? Do you know a workaround that I can use? Previous Comments: ------------------------------------------------------------------------ [2004-04-19 15:13:27] wez@php.net No, the problem is in setlocale(). When you set LC_NUMERIC or LC_ALL and the decimal point is not '.', then LC_NUMERIC is set back to "C" again. This hack is required for serialize() when handling floating point numbers. ------------------------------------------------------------------------ [2004-04-19 14:28:22] bublavas at ecetra dot com Description: ------------ nl_langinfo returns wrong values for THOUSEP and RADIXCHAR after setting the locale to 'de_DE'. Using localeconv() returns the same wrong values. An equivalent C program returns correct results. PHP 4.3.4 returns the same results as 4.3.6; executing the script from the command line vs. using HTTP (Apache 2.0.48) makes no difference as well. Reproduce code: --------------- if ( setlocale(LC_ALL, 'de_DE') ) { echo "thousands separator: ", nl_langinfo(THOUSEP), "\n"; echo "decimal point: ", nl_langinfo(RADIXCHAR), "\n"; } else { echo "cannot set locale to de_DE", "\n"; } Expected result: ---------------- thousands separator: . decimal point: , Actual result: -------------- thousands separator: decimal point: . ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28057&edit=1

« previous php.bugs (#58379) next »