O and Ö order as same character with ORDER in Zend_Db
When I pick up objects from t开发者_运维知识库he database and run the Zend magic function -> Order (), or as plain SQL, for example, title, and those containing Swedish characters as åäö so interpreted them as aao. It comes with the wrong sort, either a or o when it really should be ordered last.
Anyone got a clue how to solve this? Have looked like an idiot with no result.
Edit: The collation of the database is utf8_unicode_ci and the encoding is utf8. I have tried to change to utf8_swedish_ci but with no success. And I'm afraid I need to have the utf8 left or do I not any choice there?
Is your MySQL database set up to use the proper collation? I think by default it's set to the Swedish collation latin1_swedish_ci
: http://dev.mysql.com/doc/refman/5.5/en/charset-we-sets.html
But if it's been changed to something else (like latin1
) it might order the accented characters differently.
There are instructions on how to specify which collation to use for a particular DB, column, or table here:
http://dev.mysql.com/doc/refman/5.0/en/charset-syntax.html
Edit: The Swedish collation is what you want: http://www.collation-charts.org/mysql60/mysql604.latin1_swedish_ci.html but you are likely using the general one: http://www.collation-charts.org/mysql60/mysql604.latin1_general_ci.html
精彩评论