[php-src] Issue #15076: In Czech function have bad order with diacritic
| From: | JosefNemc | Date: | Tue, 23 Jul 2024 09:27:55 +0000 |
| Subject: | [php-src] Issue #15076: In Czech function have bad order with diacritic | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247348@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15076
Author: JosefNemc
I found bug in ordering with A and Á.
In Czech is correct order A, Á, B, C ,D.. etc.
In word like Napajedla, Náchod, but this class return me Náchod, Napajedla in this order and this
is not correct.
my code:
usort($typesArray, function($a, $b) {
$coll = collator_create(get_locale());
collator_set_strength($coll, Collator::SECONDARY);
return collator_compare($coll, $a->name, $b->name);
});
Other version of code
usort( $typesArray, function($a, $b) {
$coll = collator_create('cs_CZ');
$a = collator_get_sort_key($coll,$a->name);
$b = collator_get_sort_key($coll,$b->name);
return $a >= $b;
I'm testing many variant but Náchod is first and this is not correct.