php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61082 localeconv() returns space with int_curr_symbol
Submitted: 2012-02-14 14:20 UTC Modified: 2012-02-15 00:15 UTC
From: leods92 at gmail dot com Assigned:
Status: Not a bug Package: I18N and L10N related
PHP Version: 5.3.10 OS: Ubuntu
Private report: No CVE-ID: None
 [2012-02-14 14:20 UTC] leods92 at gmail dot com
Description:
------------
The function localeconv() returns an array and one of its keys is 
'int_curr_symbol' what I expected to return the international currency symbol 
(e.g. USD (US dollar), BRL (Brazilian real)).

I develop in a Windows environment and deploy to a Ubuntu machine and that's why 
I'm not sure if this is a bug of PHP, bad implementation of standards by Windows 
or Ubuntu or an undocumented difference.

The returned int_curr_symbol from the Ubuntu machine contains an extra space at 
the end but the one from Windows doesn't. Researching online all I found were old 
specification documents. Correct me if I am wrong but from what I understood from 
some documents adding a space to the int_curr_symbol is deprecated.

Test script:
---------------
<?php
  setlocale(LC_MONETARY, 'en_US');
  $x = localeconv();
  echo $x['int_curr_symbol'];
?>

Expected result:
----------------
$x['int_curr_symbol'] should output 'USD'.

Actual result:
--------------
$x['int_curr_symbol'] should outputs 'USD '.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-15 00:15 UTC] aharvey@php.net
Thanks for the report. PHP just returns whatever the system's localeconv() 
provides, so if there's an unexpected space, that's coming from Ubuntu's locale 
database and needs to be reported to them.
 [2012-02-15 00:15 UTC] aharvey@php.net
-Status: Open +Status: Not a bug
 [2012-02-15 09:09 UTC] leods92 at gmail dot com
I don't have other Linux machines nor OS X here installed to test the behavior. 
But if it's standard to UNIX systems, shouldn't then this OSes difference be 
documented? It may save someone's time on troubleshooting.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Aug 08 21:01:26 2020 UTC