Simple question about PHP Mysql full-text search

here I go…

Searching English text works nicely(min. 3 characters), but if I try to search something like china, Japanese(like 車 or 住まい, 東京), even Arabic works ( السيارات) but not all, also “äöüõ” characters seems to feel like empty spaces for PHP Mysql full-text search boolean mode.

also I use htmlspecialchars($q,ENT_QUOTES,"UTF-8");.
tables are myisama utf 8
( LIKE searches work all languages)

is there anything I can do to fix this, should add a extra like %keyword% to full-text search(if match against is so bad to use alone)

or do I need to change some database settings :?

I don’t have any operators added, +,- etc.

I read all the stuff Mysql FS manual, but really nothing useful that would fix all. probably would change db text search character limit to 1 but probably isn’t a solution.

Thank you!

This seems to be a problem caused by the encoding of the database. Your database must be encoded with UTF-8. If you look at the data at your tables and you see readable chars like 住まい or whatever, you will have to convert its data. First of all make a backup of the problematic table and try to convert its special chars to UTF-8. If you could put some samples of the defective rows here that would be great.

1 Like

Thank you very much for answering. After hard searching and discussions I found out the problem, that PHP code needs this:

mysqli_set_charset($dbconnect, 'utf8');  
mysqli_query($dbconnect, "SET NAMES 'utf8';");
mysqli_query($dbconnect, "SET CHARACTER SET 'utf8';");
mysqli_query($dbconnect, "SET COLLATION_CONNECTION = 'utf8_unicode_ci';");


only first one is actually needed and should be used

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.