Welcome to WebmasterWorld Guest from 54.145.136.73

Forum Moderators: coopster & jatar k

Searching a database with accented characters

international characters

   
5:18 pm on Sep 17, 2002 (gmt 0)

10+ Year Member



Hello:

We have a database in MySQL that contains data with accentuated characters (Brazilian Portuguese). The scripts system is in PHP.

When it is made a search in this database, the system seeks and it returns records from the database that match exactly the characters, as they were typed. For instance: if the user types in the search field "São José" (accented), the system doesn't find records that contains "Sao Jose" (without accents). Still, if the search is made by "Sao Jose" (without accents), the system doesn't find records that contains "São José" (accented).

Does some way exist that PHP/MySQL returns all of the occurrences in function of the characters, ignoring its accentuation, in other words, independently if the characters in the database OR search field are or not accentuated?

Thank you very much

Valter - Brazil

5:33 pm on Sep 17, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome to WebmasterWorld valterg

I think your main problem here is data integrity. The two phrases aren't the same from an ascii point of view. I would suggest streamlining the data when it is inserted into the db. Either, removing all accents or making sure they are all there(which is alot of work). We did have a discussion about removing special chars that might help.

Removing umlauts from PHP [webmasterworld.com]

someone else may know a better solution though.

5:51 pm on Sep 17, 2002 (gmt 0)

10+ Year Member



Hello Valterg,
I have a database with spanish accents and all, and I get results by using LIKE in my SQL statement:
select * from some_table where nombre LIKE '%Mexico%'

This matches records containing México (accented) and Mexico (no accent).

How do you have your SQL statement?
Hope this helps.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month