php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23363 setlocale() not working
Submitted: 2003-04-26 12:39 UTC Modified: 2003-04-26 16:04 UTC
From: bmansion at mamasam dot com Assigned:
Status: Not a bug Package: *Languages/Translation
PHP Version: 4.3.2RC1 OS: Mac OSX 10.2.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bmansion at mamasam dot com
New email:
PHP Version: OS:

 

 [2003-04-26 12:39 UTC] bmansion at mamasam dot com
Ex : setlocale(LC_CTYPE, 'fr');

This does not work with MacOSX, LC_ALL neither.
Locale can be found in /usr/share/locale/, they are installed by default.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-26 13:27 UTC] msopacua@php.net
Use 'fr_FR', since there is no:
/usr/share/locale/fr/LC_CTYPE.

LC_ALL doesn't work at all on Mac OSX, as far as I can tell (not only in PHP, but in C also).
 [2003-04-26 16:04 UTC] bmansion at mamasam dot com
/usr/share/locale/fr_FR.ISO8859-1 has LC_CTYPE.

Apparently, it is possible to use at least LC_CTYPE, 
ht://dig does it [1]

But this code won't work:

setlocale(LC_CTYPE, 'fr_FR.ISO8859-1');
// or setlocale(LC_CTYPE, 'fr_FR');
$words = $nonwords = '';
for ($i=0; $i < 255; $i++) {
	if (ctype_alnum(chr($i))) {
		$words .= chr($i);
	} else {
		$nonwords .= chr($i);
	}
}

It behaves like 'C' locale.


[1] http://www.stepwise.com/Articles/Workbench/2002-11-
01.01.html
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC