Page 1 of 1

remove accent

Posted: Sun Apr 27, 2008 10:09 pm
by yacahuma
Hello,


I am creating a site in spanish. People are going to be searching stuff by person name. Some people may enter the name with accent and some dont. My idea was to create an extra field in the table to keep the not_accented name. At the time of the search just remove the accent and search againt the no accent column.

First, if you have a better idea, let me know.

The problem is that I dont seem to be able to remove the accent. I tried the functions in php.net for strtr but they dont seem to work. I always get the same input word.


my page have the content uf8 and mysql table is utf8


any ideas.

Re: remove accent

Posted: Mon Apr 28, 2008 1:40 am
by Kieran Huggins
You could try converting the charset to latin1 in MySQL (during the match, no need for a separate column):

Code: Select all

SELECT * FROM `sometable` WHERE CONVERT( _utf8 '$name' USING latin1 ) LIKE CONVERT( _utf8 `name` USING latin1 )
also, it should leave both your dataset and form untouched.

Re: remove accent

Posted: Sun May 04, 2008 5:47 pm
by yacahuma
Hello, sorry it took so long , but I always get a syntax error when running that sql.