I\'m trying to sort a list with asc or desc - depending on what the user choose. In the list I have the Swedish characters Å Ä Ö and it\'s here the problem shows up. I have
The general collation places Ö
with O
. If you want Ö
at the end of the alphabet then you need to use utf8_swedish_ci.
If you want to convert existing tables to a new collation, just use the following:
alter table [tableName] convert to character set utf8 collate utf8_swedish_ci;
My database and the field that the value is in have the collation utf8_general_ci, so that is'nt the problem
But it is. :) Different collations have different sort orders, and different ways how they interpret umlauts.
utf8_general_ci
will sort Ö
with O
. Try the utf8_swedish_ci
instead. That will have the correct sorting order, which (IIRC) is that ÄAÖ
go to the end of the alphabet.
For background info, see 9.1.7.8. Examples of the Effect of Collation