homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Searching a database with accented characters
international characters

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


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)

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)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved