#44041 [Fbk->Opn]: number_format returns garbage for thousands sep and latvian locale

From: Date: Tue, 05 Feb 2008 07:31:30 +0000
Subject: #44041 [Fbk->Opn]: number_format returns garbage for thousands sep and latvian locale
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-121988@lists.php.net to get a copy of this message
ID: 44041 User updated by: trickie at gmail dot com Reported By: trickie at gmail dot com -Status: Feedback +Status: Open Bug Type: *General Issues Operating System: Gentoo Linux PHP Version: 5.2.5 New Comment: Output requested: array(18) { ["decimal_point"]=> string(1) "," ["thousands_sep"]=> string(2) "&#65533;&#65533;" ["int_curr_symbol"]=> string(4) "LVL " ["currency_symbol"]=> string(2) "Ls" ["mon_decimal_point"]=> string(1) "," ["mon_thousands_sep"]=> string(2) "&#65533;&#65533;" ["positive_sign"]=> string(0) "" ["negative_sign"]=> string(1) "-" ["int_frac_digits"]=> int(2) ["frac_digits"]=> int(2) ["p_cs_precedes"]=> int(1) ["p_sep_by_space"]=> int(1) ["n_cs_precedes"]=> int(1) ["n_sep_by_space"]=> int(1) ["p_sign_posn"]=> int(3) ["n_sign_posn"]=> int(3) ["grouping"]=> array(2) { [0]=> int(3) [1]=> int(3) } ["mon_grouping"]=> array(2) { [0]=> int(3) [1]=> int(3) } } Previous Comments: ------------------------------------------------------------------------ [2008-02-05 05:09:48] jani@php.net What does this output: <?php if (false !== setlocale(LC_ALL, 'lv_LV.UTF-8')) { $locale_info = localeconv(); var_dump($locale_info); } ?> ------------------------------------------------------------------------ [2008-02-04 15:18:20] trickie at gmail dot com Description: ------------ If you set the locale to 'lv_LV.UTF-8' and have the locale generated on your system, then the code below will return garbage as the 'thousands separator'. It displays ok for me when running with CLI SAPI Reproduce code: --------------- <?php if (false !== setlocale(LC_ALL, 'lv_LV.UTF-8')) { $locale_info = localeconv(); echo number_format(20000,0,$locale_info['decimal_point'], $locale_info['thousands_sep']); } ?> Expected result: ---------------- 20 000 Actual result: -------------- 20&#65533;000 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44041&edit=1

« previous php.bugs (#121988) next »