I've noticed that on some installs of CiviCRM 4.6 that I'm working with, when using a profile that includes the Country field, for an address for example, I'm seeing that Côte d'Ivoire is listed after Czech Republic, when it should be listed just after Costa Rica.

The order in the database table is correct, so what's causing the listing order to change? I can't reproduce this on the demo site, and the sites that I am seeing it on are using a different default language (English UK as opposed to US English). Might that be a cause of the issue? Any clues as to how to fix this minor yet irritating issue very welcome.

  • Just tested again on the demo site, and if I change the default language there to UK English, the sort order changes as well, and Côte d'Ivoire moves position in the list to follow the Czech Republic. Deliberate outcome of cultural differences in sorting/listing, or a bug?
    – Graham
    Oct 7, 2015 at 12:14
  • 2
    @DaveFF I think you should make your comment an answer.
    – Coleman
    Oct 7, 2015 at 14:55

1 Answer 1


I'm guessing it's whether the particular sort implementation in each case is configured to be UTF8-aware. If I order by name asc in MySQL, I see Côte d'Ivoire just after Costa Rica. If I look at a hex dump of the actual bytes, ô expands to EF BF BD, which will appear long after o (6F) and even z if the sort isn't UTF8-aware. Have a look at the localisation configuration of PHP on your servers.

Sort order can be affected by cultural differences as you suspected, eg Swedish vs German at https://sgehrig.wordpress.com/2008/09/24/on-how-to-sort-an-array-of-utf-8-strings/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.