Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP array asort accented character
    primarykey
    data
    text
    <p>I have a page with a <code>SELECT</code> tag proposing to choose between multiple countries. The <code>SELECT</code> options are dynamically generated, a SQL query select all the countries from the database, not sorted, and add them into an array. Then, I use asort to sort the array and propose the <code>SELECT</code>. It works as long as there isn't accented characters, and accented character options are sorted after everything.</p> <p>Check it on the page : <a href="http://worldisbeautiful.net/partager/?force_language=fr" rel="nofollow noreferrer">http://worldisbeautiful.net/partager/?force_language=fr</a></p> <ul> <li>make sure <em>force_language=fr</em> is on, otherwise it will be english by default</li> <li>check the source code, you'll see 3 commented tests I made with the results</li> </ul> <p>I tried, with no luck, solutions proposed on these questions :</p> <ul> <li><a href="https://stackoverflow.com/questions/10649473/sort-an-array-with-special-characters-in-php?rq=1">Sort an array with special characters in PHP</a></li> <li><a href="https://stackoverflow.com/questions/13571273/sorting-array-with-collation?rq=1">Sorting array with collation</a></li> <li><a href="https://stackoverflow.com/questions/10273165/how-to-sort-an-array-considering-localization">How to sort an array considering localization?</a></li> </ul> <p>For information, i receive sorted country data from databases but in english, then i localize them in french and due to complete name change it's unsorted (ie in french, united stats is états-unis).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload