XF 2.0 XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xF0\x9F\x98\x90' for column 'message' at row 1 src/XF/Db/AbstractStatement.php:21

truonglv

Well-known member
Hi there. I faced this issues:
Code:
[LIST]
[*]XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xF0\x9F\x98\x90' for column 'message' at row 1
[*]src/XF/Db/AbstractStatement.php:212
[/LIST]
More stacks:
Code:
INSERT  INTO `xf_post` (`thread_id`, `message_state`, `user_id`, `username`, `message`, `embed_metadata`, `post_date`, `post_id`, `ip_id`, `attach_count`, `likes`, `like_users`, `warning_id`, `warning_message`, `last_edit_date`, `last_edit_user_id`, `edit_count`, `position`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1366, '22007')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1366, '22007')
#2 src/XF/Db/AbstractAdapter.php(79): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(160): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1389): XF\Db\AbstractAdapter->insert('xf_post', Array, false)
#5 src/XF/Mvc/Entity/Entity.php(1121): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Service/Thread/Replier.php(161): XF\Mvc\Entity\Entity->save(true, false)
#7 src/XF/Service/ValidateAndSavableTrait.php(40): XF\Service\Thread\Replier->_save()
#8 src/XF/Pub/Controller/Thread.php(431): XF\Service\Thread\Replier->save()
#9 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', 'json', Object(XF\Mvc\ParameterBag), 'forums', Object(XF\Pub\Controller\Thread), NULL)
#11 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(1891): XF\Mvc\Dispatcher->run()
#13 src/XF.php(328): XF\App->run()
#14 index.php(13): XF::runApp('XF\\Pub\\App')
#15 {main}
 
https://stackoverflow.com/questions...string-value-xf0-x9f-x98-x9c-for-column-comme

New installs
If you are installing a brand new XenForo, rather than upgrading from an existing version, you may include emoji support from the outset. The installer will add the necessary line to your src/config.php file automatically, if you allow the installation system to build your config file for you.
If you want to build your config file manually, simply add the following line to the end of the file using a text editor before you run the installation script:
$config['fullUnicode'] = true;

Running the conversion script
Log in to your server using SSH, or open a command prompt over Remote Desktop if you are using a Windows server.
When you have a command line available, change your current working directory to your XenForo directory. You will know that you are in the correct directory, as it will contain a script called cmd.php.
You can now run the following command:
php cmd.php xf:convert-utf8mb4

After running the script
Once the script has finished its work, open your src/config.php file in a text editor and add the following line to the end of the file:
$config['fullUnicode'] = true;
Your forum will now fully support emoji in user generated content.

https://xenforo.com/xf2-docs/manual/unicode/
 
Top Bottom