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

2004-04-19 Thread bublavas at ecetra dot com
From: bublavas at ecetra dot com
Operating system: 2.4.21-9.EL GNU/Linux
PHP version:  4.3.6
PHP Bug Type: Strings related
Bug description:  nl_langinfo returns wrong data for de_DE

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 bug report at http://bugs.php.net/?id=28057edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28057r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28057r=trysnapshot5
Fixed in CVS:   http://bugs.php.net/fix.php?id=28057r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=28057r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28057r=needtrace
Need Reproduce Script:  http://bugs.php.net/fix.php?id=28057r=needscript
Try newer version:  http://bugs.php.net/fix.php?id=28057r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=28057r=support
Expected behavior:  http://bugs.php.net/fix.php?id=28057r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=28057r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=28057r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=28057r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28057r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=28057r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=28057r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=28057r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28057r=float


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

2004-04-19 Thread bublavas at ecetra dot com
 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] [EMAIL PROTECTED]

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=28057edit=1