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"");
  • The name field in the database is ‘utf8_unicode_ci’

1 Answer
1

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.

Leave a Reply

Your email address will not be published. Required fields are marked *