# Accentuated characters with find function

**URL:** <https://www.ruby-forum.com/t/accentuated-characters-with-find-function/72658>\
**Category:** Rails\
**Created:** [October 18, 2006, 10:40am UTC](https://www.ruby-forum.com/t/accentuated-characters-with-find-function/72658 "2006-10-18T10:40:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@maxime](https://www.ruby-forum.com/u/maxime)\
**Post date:** [October 18, 2006, 10:40am UTC](https://www.ruby-forum.com/t/accentuated-characters-with-find-function/72658/1 "2006-10-18T10:40:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![maxime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@maxime](https://www.ruby-forum.com/u/maxime)\
**Post date:** [October 18, 2006, 10:43am UTC](https://www.ruby-forum.com/t/accentuated-characters-with-find-function/72658/2 "2006-10-18T10:43:59Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![maxime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@maxime](https://www.ruby-forum.com/u/maxime)\
**Post date:** [October 18, 2006, 10:44am UTC](https://www.ruby-forum.com/t/accentuated-characters-with-find-function/72658/3 "2006-10-18T10:44:13Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![maxime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@maxime](https://www.ruby-forum.com/u/maxime)\
**Post date:** [October 23, 2006, 3:55am UTC](https://www.ruby-forum.com/t/accentuated-characters-with-find-function/72658/4 "2006-10-23T03:55:58Z")

</div>

Sorry for the delay… lot of work here.

On Oct 17, 3:52 am, “Maxime” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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
