[wp-trac] [WordPress Trac] #15652: Tags with Accents are Incorrectly Sorted in Cloud

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 2 18:23:44 UTC 2010


#15652: Tags with Accents are Incorrectly Sorted in Cloud
--------------------------+-------------------------------------------------
 Reporter:  CatherineBr   |       Owner:                               
     Type:  defect (bug)  |      Status:  new                          
 Priority:  normal        |   Milestone:  Awaiting Review              
Component:  General       |     Version:  3.0.2                        
 Severity:  normal        |    Keywords:  sorting, sort, accents, cloud
--------------------------+-------------------------------------------------
 By accents, I mean letters like "é", "ü", "ç", "î", etc.

 Currently, in a tag cloud, the word "égypte" gets sorted AFTER the word
 "zimbabwe". This is incorrect alphabetical sorting. A correct sorting
 would consider "é" as equivalent to "e", and place "égypte" BEFORE the
 word "zimbabwe".

 The problem stems from this line in CATEGORY-TEMPLATE.PHP :

 uasort( $tags, create_function('$a, $b', 'return strnatcasecmp($a->name,
 $b->name);') );

 As a temporary solution, I am using this code :

 function replace_accents($str) {
   $str = htmlentities($str, ENT_COMPAT, 'UTF-8');
   $str = preg_replace('/&([a-zA-Z])(uml|acute|grave|circ|tilde);/', '$1',
 $str);
   return html_entity_decode($str);
 }
 uasort( $tags, create_function('$a, $b', 'return strnatcasecmp($a->name,
 $b->name);') );

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15652>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list