#32219 [Ver->Asn]: Alphabetical sort with accented characters
| From: | tony2001@php.net | Date: | Tue, 05 Apr 2005 08:13:12 +0000 |
| Subject: | #32219 [Ver->Asn]: Alphabetical sort with accented characters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76360@lists.php.net to get a copy of this message | ||
ID: 32219
Updated by: tony2001@php.net
Reported By: php-france at mattoug dot net
-Status: Verified
+Status: Assigned
Bug Type: *General Issues
Operating System: *
PHP Version: 4CVS-2005-03-09
-Assigned To:
+Assigned To: derick
New Comment:
Derick, so is it a bug or not?
Previous Comments:
------------------------------------------------------------------------
[2005-03-08 23:33:03] sniper@php.net
Saying that something is supported in PHP 5 isn't gonna make this
'feature' (or fix, IMO) end up in PHP 4. Backport it is.
------------------------------------------------------------------------
[2005-03-08 23:17:10] derick@php.net
No bug here, PHP 4 never had support for sorting locale based. I added
this function to PHP 5.0.2 to support it.
------------------------------------------------------------------------
[2005-03-08 23:11:54] sniper@php.net
It's a bug if *sort() functions can't handle locales correctly.
------------------------------------------------------------------------
[2005-03-07 23:49:57] derick@php.net
No bug here, the functions don't understand locales unless you add as
second "sort-flag" parameter SORT_LOCALE_STRING to asort(). This option
is introduced in PHP 5.0.2.
The following works fine (if you have the fr_FR locale installed):
<?php
setlocale(LC_ALL, 'fr_FR');
$table = array("AB" => "Alberta",
"BC" => "Colombie-Britannique",
"MB" => "Manitoba",
"NB" => "Nouveau-Brunswick",
"NL" => "Terre-Neuve-et-Labrador",
"NS" => "Nouvelle-Écosse",
"ON" => "Ontario",
"PE" => "Île-du-Prince-Édouard",
"QC" => "Québec",
"SK" => "Saskatchewan",
"NT" => "Territoires du Nord-Ouest",
"NU" => "Nunavut",
"YT" => "Territoire du Yukon");
asort($table, SORT_LOCALE_STRING);
var_dump($table);
------------------------------------------------------------------------
[2005-03-07 19:31:22] sniper@php.net
With what locale do you expect that output?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/32219
--
Edit this bug report at http://bugs.php.net/?id=32219&edit=1