How to sort an array of UTF-8 strings?

后端 未结 8 773
刺人心
刺人心 2020-11-27 04:32

I currentyl have no clue on how to sort an array which contains UTF-8 encoded strings in PHP. The array comes from a LDAP server so sorting via a database (would be no probl

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 04:52

    Your collation needs to match the character set. Since your data is UTF-8 encoded, you should use a UTF-8 collation. It could be named differently on different platforms, but a good guess would be de_DE.utf8.

    On UNIX systems, you can get a list of currently installed locales with the command

    locale -a
    

提交回复
热议问题