php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38314 setlocale() - LC_NUMERIC does not work
Submitted: 2006-08-03 14:14 UTC Modified: 2006-08-04 07:53 UTC
From: akorthaus at web dot de Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.0RC1 OS: Mac OS X (10.4.7)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: akorthaus at web dot de
New email:
PHP Version: OS:

 

 [2006-08-03 14:14 UTC] akorthaus at web dot de
Description:
------------
LC_NUMERIC does not work, it only makes localeconv() return the correct decimal_point, nothing else.

If I use LC_ALL, localeconv() works better (more data, e.g. mon_*) but thousands_sep is still wrong (empty).

I installed PHP 5.2.0 RC1 on a MacBook and run "make test", you can find the results here:

http://news.php.net/php.qa/26855

The same happens with PHP 4.4.1, shiped with OS X!

Reproduce code:
---------------
<?php
$ret = setlocale(LC_NUMERIC, "de_DE");
var_dump($ret);
$lc = localeconv();
print_r($lc);

$ret = setlocale(LC_ALL, "de_DE");
var_dump($ret);
$lc = localeconv();
print_r($lc);
?>



Actual result:
--------------
string(5) "de_DE"
Array
(
    [decimal_point] => ,
    [thousands_sep] => 
    [int_curr_symbol] => 
    [currency_symbol] => 
    [mon_decimal_point] => 
    [mon_thousands_sep] => 
    [positive_sign] => 
    [negative_sign] => 
    [int_frac_digits] => 127
    [frac_digits] => 127
    [p_cs_precedes] => 127
    [p_sep_by_space] => 127
    [n_cs_precedes] => 127
    [n_sep_by_space] => 127
    [p_sign_posn] => 127
    [n_sign_posn] => 127
    [grouping] => Array
        (
            [0] => 127
        )

    [mon_grouping] => Array
        (
            [0] => 127
        )

)
string(5) "de_DE"
Array
(
    [decimal_point] => ,
    [thousands_sep] => 
    [int_curr_symbol] => EUR 
    [currency_symbol] => Eu
    [mon_decimal_point] => ,
    [mon_thousands_sep] => .
    [positive_sign] => 
    [negative_sign] => -
    [int_frac_digits] => 2
    [frac_digits] => 2
    [p_cs_precedes] => 1
    [p_sep_by_space] => 0
    [n_cs_precedes] => 1
    [n_sep_by_space] => 0
    [p_sign_posn] => 1
    [n_sign_posn] => 1
    [grouping] => Array
        (
            [0] => 127
        )

    [mon_grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-03 14:36 UTC] tony2001@php.net
What do you get with `locale LC_NUMERIC` in shell?
 [2006-08-04 07:47 UTC] akorthaus at web dot de
$ locale LC_NUMERIC
"."

""
 [2006-08-04 07:53 UTC] tony2001@php.net
Your locale data is obviously broken.
Not PHP problem.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Aug 16 22:00:02 2025 UTC