B
B
Bombadile2018-02-16 15:50:11
Yii
Bombadile, 2018-02-16 15:50:11

Why is the emoji string not being added to MS-SQL via Yii2?

There is a code that fails with an error - General error: 102 General SQL Server error: Check messages from the SQL Server [102] (severity 15)

$connection = Yii::$app->getDb();
$command = $connection->createCommand("INSERT INTO [example] ([title]) VALUES (N' Эмоджи')");      
$command->execute();

I remove the smiley - everything is OK (in the example, the Toaster cut the emoji smiley in the sql code). The field type is nvarchar(1000). Through the manager of a DB such sql-code fulfills normally. PHP version 7.1.8.
What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mitaichik, 2018-02-16
@mitaichik

Encoding must be utf8mb4

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question