accented character conflation?

Hello,

I am using rails 2.1 and mysql with utf8

Character.all(:conditions => { :name => ‘à’ }) => [#<Character id: 2, name: “a”>, #<Character id: 56, name: “à”>] Character.all(:conditions => { :name => ‘à’ }).last.name => “à” Character.all(:conditions => { :name => ‘à’ }).last.name == ‘a’ => false Character.all(:conditions => { :name => ‘à’ }).last.name == ‘à’ => true

I use uniqueness validation on the name column and it correctly does not complain that a is the same as à. Also ruby-internally the two strings/chars are different. but when I do retrieval they are conflated and considered identical? see above and also:

Character.find_all_by_name(‘a’) => [#<Character id: 2, name: “a”>, #<Character id: 56, name: “à”>]

Character.find_all_by_name(‘à’) => [#<Character id: 2, name: “a”>, #<Character id: 56, name: “à”>]

Also, using find_or_create_by_name works incorrectly. What am i doing wrong? Is this a bug somewhere?

Thanks for help

Vik

MySQL is accent insensitive (by default, I think you can change it). Ruby is accent sensitive.