I've just a simple query to fetch a students records by his name, written in Bengali.
$student_rcrd = $wpdb->get_results("SELECT * FROM student WHERE name='আবুল কালাম আজাদ'");
Although my database have a record for 'আবুল কালাম আজাদ', the query returns zero row! But instead of this query, it works absolutely fine-
$student_rcrd = $wpdb->get_results("SELECT * FROM student WHERE name='Abul Kalam Azad'");
I've just a simple query to fetch a students records by his name, written in Bengali.
$student_rcrd = $wpdb->get_results("SELECT * FROM student WHERE name='আবুল কালাম আজাদ'");
Although my database have a record for 'আবুল কালাম আজাদ', the query returns zero row! But instead of this query, it works absolutely fine-
$student_rcrd = $wpdb->get_results("SELECT * FROM student WHERE name='Abul Kalam Azad'");
Your data are possibly corrupt from trying to store multibyte characters that your DB could not correctly represent. MySQL's utf8
collation isn't actually UTF-8. You will have to convert your tables' character sets to utf8mb4
(real UTF-8), and then set the DB_CHARSET
constant to match.
php
file itself is saved as unicodeUTF8
(without BOM) from your editor. – Fayaz Commented Sep 6, 2018 at 5:21add_filter( 'pre_get_table_charset', '__return_false' );
before the query and see if it works. If it does, then it's a collation issue (don't actually use it on production, this is just for test). – Fayaz Commented Sep 6, 2018 at 5:47