php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49520 Case sensitivity in setlocale()
Submitted: 2009-09-10 10:43 UTC Modified: 2009-09-11 07:07 UTC
From: jchochola at demsys dot cz Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.10 OS: Debian 4.0
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jchochola at demsys dot cz
New email:
PHP Version: OS:

 

 [2009-09-10 10:43 UTC] jchochola at demsys dot cz
Description:
------------
setlocale( LC_ALL, 'Czech' ) does not work in my ISP's environment; one has to use lowercase 'czech' instead. The ISO639 (mentioned in setolcale() docs) lists country names with capitalized first letters, ie. setlocale() should accept 'Czech' or not to mention ISO639 at all.

'Czech' locale is OK under XAMPP used for local debugging.

I can't imagine why such functions should use case-sensitive string params.


Reproduce code:
---------------
//---
//From manual page: function.setlocale
//---
function e( $s ) {
  eval( '$r = '.$s.';' );
  echo $s, ' returns ', $r ? 'true (\''.$r.'\')' : 'false', "\n";
}
e( "setlocale( LC_ALL, 'Czech' )" );
e( "setlocale( LC_ALL, 'czech' )" );


Expected result:
----------------
setlocale( LC_ALL, 'Czech' ) returns true ('Czech')
setlocale( LC_ALL, 'czech' ) returns true ('czech')


Actual result:
--------------
setlocale( LC_ALL, 'Czech' ) returns false
setlocale( LC_ALL, 'czech' ) returns true ('czech')



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-10 13:12 UTC] jani@php.net
Locales are OS issue, not PHP issue. We don't have control over what OS might or might not support. Read more at http://php.net/setlocale

"Different systems have different naming schemes for locales."
 [2009-09-11 07:07 UTC] jchochola at demsys dot cz
...which is pitty, and as PHP is not an integral part of the hosting OS, it should (or at least could) implement a unifying (platform dependent) layer above the C-lib's setlocale().

I hoped it's clear I really did read the setlocale()'s doc from the text of the original post. I consulted the ISO it mentioned and...following it was a kind of failure to me. My fault, I've to learn English better.

Maybe it's time to fork&reclassify (and reopen) this BR to docs issue and feature request...?

Thx for your Re: anyway.

Have a nice day,
H.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 19:01:28 2024 UTC