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? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, Jun 12, 2010 at 7:11 AM, jeb <jonas-sgoA4MbTzF0@public.gmane.org> wrote:> 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".If you run the query generated by ActiveRecord manually in a MySQL console, do you get the result you expect? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No, I get the wrong result. On 12 Juni, 16:50, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sat, Jun 12, 2010 at 7:11 AM, jeb <jo...-sgoA4MbTzF0@public.gmane.org> wrote: > > 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". > > If you run the query generated by ActiveRecord manually in a MySQL > console, do you get the result you expect? > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, Jun 12, 2010 at 8:32 AM, jeb <jonas-sgoA4MbTzF0@public.gmane.org> wrote:>> 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? mysql> show variables like ''%collation%''; mysql> show variables like ''%char%''; -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
jeb wrote:> Hi all, > > I have a MySQL DB in my production environment with collation set to > latin1_swedish_ciThis 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, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.