#49398 [Opn->Bgs]: number_format returns invalid character with some charsets
| From: | jani@php.net | Date: | Sat, 29 Aug 2009 00:24:39 +0000 |
| Subject: | #49398 [Opn->Bgs]: number_format returns invalid character with some charsets | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-141677@lists.php.net to get a copy of this message | ||
ID: 49398
Updated by: jani@php.net
Reported By: mark dot j dot wade at googlemail dot com
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: Linux
PHP Version: 5.2.10
New Comment:
Thank you for not searching before submitting another bogus bug. See
also bug #44041
Previous Comments:
------------------------------------------------------------------------
[2009-08-28 12:46:48] mark dot j dot wade at googlemail dot com
Description:
------------
number_format will only accept a single character for the thousands
separator and deliberately shortens longer input to one character.
However, for some charsets (ru_RU.UTF8 was the one I discovered this
on)
the thousands separator as returned by localeconv is more than one
character.
Normally, this wouldn't be a problem, however, it seems when PHP tries
to shorten this particular value to one character, it creates an
invalid
character and returns something like demonstrated in the reproduce
code.
Reproduce code:
---------------
setlocale( L_ALL, 'ru_RU.UTF8' );
$locale = localeconv();
echo number_format( 9999, 0, $locale['decimal_point'],
$locale['thousands_sep'] );
Expected result:
----------------
9 999
Actual result:
--------------
9?999
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49398&edit=1