Swedish sort order not working

Hi all,

I have a MySQL DB in my production environment with collation set to latin1_swedish_ci

When I do a simple find and order by 'name' the names are not sorted in Swedish order. They are "Anna, Östen, Kalle, Rut" when they should be "Anna, Kalle, Rut, Östen".

I guess a simple sort shall work without having to alter the table to utf8?

Any idears?

If you run the query generated by ActiveRecord manually in a MySQL console, do you get the result you expect?

No, I get the wrong result.

If you run the query generated by ActiveRecord manually in a MySQL console, do you get the result you expect?

No, I get the wrong result.

Can you construct a query that *does* return the result you expect?

What do the following commands show?

jeb wrote:

Hi all,

I have a MySQL DB in my production environment with collation set to latin1_swedish_ci

This is not a Rails question; it is a MySQL question. You'll get better answers in a MySQL forum. But...

My recollection is that not just the DB but also each table and each field in MySQL can have its own sort order. Make sure these are all set properly.

When I do a simple find and order by 'name' the names are not sorted in Swedish order. They are "Anna, �sten, Kalle, Rut" when they should be "Anna, Kalle, Rut, �sten".

I guess a simple sort shall work without having to alter the table to utf8?

You really *should* alter the table to UTF8. That way you'll be able to handle any conceivable character.

Any idears?

Best,