MySQL Query problem with spanish accents

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

MySQL Query problem with spanish accents

Post by emmbec »

Hi, I have a table that stores people's name, it is in Spanish, and there are some names that have an accent, like "José".

If I try the following query I get no results back:

Code: Select all

select * from people where c_name like '%Jose%';
However If I use this one, I get the guys name:

Code: Select all

select * from people where c_name like '%José%';
I think it is because José is different to Jose without the accents.

Does anyone knows how could I perform this query so I can get those people's names that have accents, even if the users writes "Jose" or "José"???

Thanks!
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Post by emmbec »

I fixed the problem, I was using latin1_general_ci collation in my database for the name column, I changed it to utf8_spanish_ci and all my problems were solved!
Post Reply