Answer the question
In order to leave comments, you need to log in
MySQL and Yii2 GridView: filtering in Russian becomes case-sensitive?
There is a table on MySQL 5.7 with utf8mb4_unicode_ci encoding and model, search model, CRUD generated to it using Gii.
On the index.php form, there is a standard GridView with filtering by fields. Only words in English are case-insensitive, and in Russian - case-sensitive, which I don't need at all.
The debugger shows that in requests the words are sent to the database in the same form as I wrote, that is, Yii2 does not seem to convert anything.
Tell me what can be done? I suspect it's MySQL? Everywhere I use utf8mb4_unicode_ci encodings
UPD: Just looked, I have commented out the charset in the Yii2 config for the base, I thought it was taken from the base, but suddenly not? I tried to put 'utf8' and 'utf8mb4' - all Russian text turns into scribbles. What is set there by default?
UDP2: added 'charset' => 'utf8mb4' to the connection settings, created an entry with the text 'Test', now searches regardless of case. It seems that all the data will have to be re-imported in order to get up under the encoding ... but it seemed that everything worked ...
Answer the question
In order to leave comments, you need to log in
It turned out that the problem was in the database connection settings, namely, I commented out the explicit setting of the font encoding.
'db' => [
'class' => 'yii\db\Connection',
...
'charset' => 'utf8mb4',
...
],
How to implement case insensitive search in MySQL?
rmcreative.ru/blog/post/utf8_unicode_ci-ili-utf8_g...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question