I have the following SQL:
INSERT INTO message (company_id,user_id,message,created,attachment_id,likes,dislikes)
VALUE(3392,18,'馃榿馃槉馃帀馃懜', '1492775564366',NULL,NULL,NULL)
from Navicate client it works but it do not work from Yii Application.
It is a serious #bug Yii2
In other words I need to run this command right after connection
ET NAMES 'utf8mb4'
My Config:
<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=gandugardi',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
],
];
The error I am getting:
Exception (Database Exception) 'yii\db\Exception' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x98\x81\xF0\x9F...
If your database requires the utf8mb4 encoding you need to configure Yii correctly to use it, i.e. set charset property of the db connection component.
Thank you for your question.
In order for this issue tracker to be effective, it should only contain bug reports and feature requests.
We advise you to use our community driven resources:
If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now.
_This is an automated comment, triggered by adding the label question._
Most helpful comment
If your database requires the
utf8mb4encoding you need to configure Yii correctly to use it, i.e. setcharsetproperty of the db connection component.