|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63326 Wrong currency format for sr_Latn locale
Submitted: 2012-10-21 10:31 UTC Modified: 2012-10-22 15:43 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: umpirsky at gmail dot com Assigned:
Status: Not a bug Package: intl (PECL)
PHP Version: 5.3.18 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: umpirsky at gmail dot com
New email:
PHP Version: OS:


 [2012-10-21 10:31 UTC] umpirsky at gmail dot com
Money for sr_Latn locale is formatted like:

din. 33

for sr_Cyrl like:

551 дин.

Cyrl version is ok, Latn looks wrong, it should be:

33 din.

Test script:

$formatter = new \NumberFormatter('sr_Latn', \NumberFormatter::CURRENCY);
echo $formatter->formatCurrency(33, 'RSD');

Expected result:
33 din.

Actual result:
din. 33


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-22 15:42 UTC]
The bug, if any, is in ICU. See instead.

My results:

$ icuinfo 
International Components for Unicode for C/C++
 Copyright (C) 2011, International Business Machines Corporation and others. All 
Rights Reserved. 
Compiled-Unicode-Version: 6.0
Runtime-Unicode-Version: 6.0
Platform: U_LINUX
Build: x86_64-pc-linux-gnu
C compiler: gcc
C++ compiler: g++
ICUDATA: icudt48l
Data Directory: 
ICU Initialization returned: U_ZERO_ERROR
Default locale: en_US
CLDR-Version: 2.0.1
Default converter: US-ASCII
Default TZ: Europe/Amsterdam
TZ data version: 2011k
Plugin file is: /usr/lib/x86_64-linux-gnu/icu/icuplugins48.txt

$ cat a.c
#include <unicode/unum.h>
#include <unicode/ustdio.h>

int main()

	UNumberFormat *unf;
	UErrorCode status = 0;
	unf = unum_open(UNUM_CURRENCY, 0, 0, "sr_Latn", NULL, &status);
	if (U_FAILURE(status)) {
		fprintf(stderr, "unum_open: %s\n", u_errorName(status));
		return 1;
	int32_t len;
	UChar result[256];
	len = unum_formatDoubleCurrency(unf, 33, (UChar[]) {'R', 'S', 'D', 0}, 
			sizeof(result)/sizeof(*result), NULL, &status);
	if (U_FAILURE(status)) {
		fprintf(stderr, "unum_formatDoubleCurrency: %s\n", 
		return 2;
	UFILE *ustdout = u_finit(stdout, NULL, NULL);
	u_fprintf(ustdout, "%.*S", (int)len, result);
	return 0;
$ clang -licui18n -licuio a.c && ./a.out | hexdump -C
00000000  64 69 6e 2e 1a 33 33                              |din..33|
 [2012-10-22 15:43 UTC]
-Status: Open +Status: Not a bug
 [2012-10-22 15:43 UTC]
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC