#25246 [Opn->Bgs]: broken locale support for decimal_point
| From: | sniper@php.net | Date: | Tue, 26 Aug 2003 10:08:05 +0000 |
| Subject: | #25246 [Opn->Bgs]: broken locale support for decimal_point | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-46654@lists.php.net to get a copy of this message | ||
ID: 25246
Updated by: sniper@php.net
Reported By: david at boe dot es
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: linux
PHP Version: 4.3.2
New Comment:
For the same reason as stated before in the urls you gave.
Previous Comments:
------------------------------------------------------------------------
[2003-08-26 05:04:05] david at boe dot es
Description:
------------
As stated in http://bugs.php.net/bug.php?id=17079
and
http://news.php.net/article.php?group=php.dev&article=95211
, PHP
always resets decimal_point to "." besides your locale
"decimal_point".
This breaks backward compatibility, at least with PHP 4.2.3
This is BAD as long as we use na Oracle database with
NLS_LANG=Spanish_Spain.WE8ISO8859P1 , needed to output regional chars
like ñ and áéíóú. This means that all operations with numerical values
returned by a database query (decimal part separated by ',') are broken
now.
In my linux:
[root@farm2 root]# export LANG=es_ES
[root@farm2 root]# locale -k decimal_point
decimal_point=","
The script:
<?php
setlocale(LC_ALL, 'es_ES');
$locale_info = localeconv();
echo "decimal_point: {$locale_info["decimal_point"]}\n";
$value1="1.5";
$value2="1,5";
$res1=$value1*1;
$res2=$value2*1;
echo "Res 1 : $res1 \n";
echo "Res 2 : $res2 \n";
?>
outputs:
decimal_point: .
Res 1 : 1,5
Res 2 : 1
Reproduce code:
---------------
In my linux:
[root@farm2 root]# export LANG=es_ES
[root@farm2 root]# locale -k decimal_point
decimal_point=","
The script:
<?php
setlocale(LC_ALL, 'es_ES');
$locale_info = localeconv();
echo "decimal_point: {$locale_info["decimal_point"]}\n";
$value1="1.5";
$value2="1,5";
$res1=$value1*1;
$res2=$value2*1;
echo "Res 1 : $res1 \n";
echo "Res 2 : $res2 \n";
?>
outputs:
decimal_point: .
Res 1 : 1,5
Res 2 : 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25246&edit=1