dannybrazil Posted July 21, 2012 Share Posted July 21, 2012 Hello My site is in PORTUGUESE (charset=iso-8859-1"). so a users name could be, for example: Marcus Marcos M?rcos Marc?s ?,?,?, ?, ?, etc.... I have an option that allows to search users on my page. I use %LIKE% in my code, but it is not working correctly. If the user name is Marcus and someone is looking for M?rcus it doesn't return anything Is there a way to disregard ACCENTS while SQL searching? just letters, pure? Danny. Quote Link to comment https://forums.phpfreaks.com/topic/266060-sql-charset-problem/ Share on other sites More sharing options...
jazzman1 Posted July 21, 2012 Share Posted July 21, 2012 In future use only utf 8 character encoding in your database. Before send your php sql statement to database, add this piece of code: mysql_query("SET NAMES utf8", $connection); Quote Link to comment https://forums.phpfreaks.com/topic/266060-sql-charset-problem/#findComment-1363366 Share on other sites More sharing options...
dannybrazil Posted July 21, 2012 Author Share Posted July 21, 2012 The part called "collation" in the DB, should be UTF8, you mean? ok I have a list of 20+ utf8_ there is no utf8_portuguese . should I choose. utf8_unicode_ci ?? Quote Link to comment https://forums.phpfreaks.com/topic/266060-sql-charset-problem/#findComment-1363369 Share on other sites More sharing options...
jazzman1 Posted July 21, 2012 Share Posted July 21, 2012 The part called "collation" in the DB, should be UTF8, you mean? ok I have a list of 20+ utf8_ there is no utf8_portuguese . should I choose. utf8_unicode_ci ?? MySql connection collation on all database to be : utf8_general_ci and collation of the tables too. Did you fix the problem with "SET NAMES UTF8" ? Quote Link to comment https://forums.phpfreaks.com/topic/266060-sql-charset-problem/#findComment-1363380 Share on other sites More sharing options...
fenway Posted July 22, 2012 Share Posted July 22, 2012 You'll need to "downgrade" both values to ASCII for the comparison. Quote Link to comment https://forums.phpfreaks.com/topic/266060-sql-charset-problem/#findComment-1363493 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.