There is a parser on yii2 (php). It parses text from various sites and inserts it into the database. When I try to save to the database, I get this error message.
Error: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF1\xE0\xEB\xEE\xED\xFB...' for column 'about' at row 1 Mysql version 5.7 Encoding
-------------- show variables like '%colla%' -------------- +----------------------+-----------------+ | Variable_name | Value | +----------------------+-----------------+ | collation_connection | utf8_general_ci | | collation_database | utf8_general_ci | | collation_server | utf8_general_ci | +----------------------+-----------------+ 3 rows in set (0.00 sec) mysql> show variables like '%charac%'; -------------- show variables like '%charac%' -------------- +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) Config connection to the database
'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=yiiutf8', 'username' => 'root', 'password' => 'xxxx', 'charset' => 'utf8', ], I tried to change the encoding to
- utf8mb4
- utf8_general_ci
- utf8_unicode_ci
- utf8mb4_general_ci
- utf8mb4_unicode_ci