Bug #78056 [Com]: Wrong currency format for nl_BE with money_format
| From: | sjon@php.net | Date: | Thu, 23 May 2019 15:07:23 +0000 |
| Subject: | Bug #78056 [Com]: Wrong currency format for nl_BE with money_format | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220975@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78056&edit=1
ID: 78056
Comment by: sjon@php.net
Reported by: wesley at weha dot be
Summary: Wrong currency format for nl_BE with money_format
Status: Not a bug
Type: Bug
Package: Strings related
Operating System: Centos 7.6
PHP Version: 7.3.5
Block user comment: N
Private report: N
New Comment:
I've reported this to glibc as https://sourceware.org/bugzilla/show_bug.cgi?id=24614
Previous Comments:
------------------------------------------------------------------------
[2019-05-23 15:04:37] requinix@php.net
Oh yes, forgot glibc does locale its own way...
Yup, looking at the glibc source
https://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales;hb=refs/heads/master
they have nl_BE copying from nl_NL which has n_sign_pos=2.
So it's an upstream bug. https://www.gnu.org/software/libc/bugs.html
------------------------------------------------------------------------
[2019-05-23 14:45:43] sjon@php.net
I actually have the exact same output on my completely up-to-date machine. It seems this is
controlled by glibc, and I have 2.29-1 installed which is the latest version.
I can confirm requinix's observation (looking at) http://www.unicode.org/cldr/charts/27/summary/nl.html
However, nl_BE LC_MONETARY is an alias to nl_NL and /usr/share/i18n/locales/nl_NL has n_sign_posn=2
- which according to https://www.gnu.org/software/libc/manual/html_node/Sign-of-Money-Amount.html
means: print minus sign after number.
So this might be a glibc bug?
------------------------------------------------------------------------
[2019-05-23 14:25:25] requinix@php.net
The output of money_format is controlled by your system's strfmon(3) function, not PHP.
Looks like your locale settings are way out of date: CLDR 26 (the relevant standard for this stuff)
is the last time the NL locale was set to use the "¤ #,##0.00-" format, and CLDR 27
changed it to "¤ -#,##0.00" - that was back in 2015.
Update your system and/or locale settings.
------------------------------------------------------------------------
[2019-05-23 14:09:04] wesley at weha dot be
Description:
------------
When I use nl_BE locale I get the wrong format for negative values.
-1234.56 should be ⬠-1 234,56
money_format gives this: ⬠1 234,56-
I'm sorry if anything is filled in wrong, first time here.
thank you.
Test script:
---------------
setlocale(LC_ALL, 'nl_BE.UTF-8')
echo money_format('%.2n','-1234.56');
Expected result:
----------------
⬠-1 234,56
Actual result:
--------------
⬠1 234,56-
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78056&edit=1