From: netspy at me dot com
Operating system: Mac OS X
PHP version: 5.2.9
PHP Bug Type: Unknown/Other Function
Bug description: strcoll() does not work with UTF-8 strings on Mac OS X
Description:
------------
strcoll() does not sort UTF-8 strings correctly on Mac OS X.
Reproduce code:
---------------
$locale = 'de_DE.UTF-8';
$string = "abcdefghijklmnopqrstuvwxyzäöüß";
$array = array();
for ($i=0; $i<mb_strlen($string, 'UTF-8'); $i++) {
$array[]=mb_substr($string, $i, 1, 'UTF-8');
}
$oldLocale = setlocale(LC_COLLATE, "0");
print("\nOld: $oldLocale New: ");
print(setlocale(LC_COLLATE, $locale));
usort($array, 'strcoll');
setlocale(LC_COLLATE, $oldLocale);
print("\n" . implode('', $array) . "\n");
Expected result:
----------------
Old: C New: de_DE.UTF-8
aäbcdefghijklmnoöpqrsßtuüvwxyz
Actual result:
--------------
Old: C New: de_DE.UTF-8
abcdefghijklmnopqrstuvwxyzßäöü
--
Edit bug report at http://bugs.php.net/?id=48322&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48322&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48322&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48322&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48322&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48322&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48322&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48322&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48322&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48322&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48322&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48322&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48322&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48322&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48322&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48322&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48322&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48322&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48322&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48322&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48322&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48322&r=mysqlcfg