Accentuated characters with find function

Hello,

I have a small problem with accentuated characters.
I have setup everything for unicode and no problem so far (I can input
chinese characters and it is displayed correctly)

The only problem appear if I do a find like:
  User.find_by_name('é')

This will give in the log:
  SELECT * FROM users WHERE (name='é') LIMIT 1

but it gives me the result of: User.find_by_name('e') without the
accent.

If I input the SQL in mysql, I got no problems.

I don't really understand why I have problems with accentuated
characters as I don't have any problem with chinese characters...

Thanks!
Maxime.

Hi!

I'm having about the same problem... but different.. look here:

http://groups-beta.google.com/group/rubyonrails-talk/browse_thread/thread/5d377d8d49a3bac3/c36087d1cf0cf804#c36087d1cf0cf804

(first time Iink to a thread in this forum, so let me know if you can
open it). The title is: "International character search"

I'm using postgresql, and I don't get the 'é' converted to 'e' ......
maybe a mysql-only "feature"?

Hope this helps,

Ildefonso Camargo

Hi!

Thanks for your answer.

It looks like that rails is doing the normalize automatically without
calling it explicitely.
I want to search with the accent, without normalization but it returns
me the non-accentuated string.
How to do that??

Maxime.

ps: your link work :slight_smile:

Sorry for the delay.... lot of work here.

Hi!

Thanks for your answer.

It looks like that rails is doing the normalize automatically without
calling it explicitely.
I want to search with the accent, without normalization but it returns
me the non-accentuated string.

Interesting.... I have never had this problem... specially because the
log says that it is using the é in the sql statement. You could try
to pass the :conditions parameter to the find function just to see:

User.find(:all,:conditions => "name='é'")

And let me know what happend.

When I get the time, I will test the "find_by_name" with postgresql,
and see if I get the same problem.

Hope this helps,

Ildefonso Camargo