Here is what you need to do in order to store and retrieve text with emojis in the database. This tutorial applies to PHPRunner 10.91 and MySQL.
- Create database and database tables. Important: use charset utf8mb4 and collation utf8mb4_unicode_ci when you create database and tables. It is also possible to change the collation of existing database but in out example we will show how to
Create database:
CREATE DATABASE emoji DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci;
Create database table:
CREATE TABLE IF NOT EXISTS `emoji` (
`id` int(11) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
In PHPRunner make sure that "Unicode (UTF-8)" is selected as Output Code Page on Miscellaneous screen.
Add the following code to AfterAppInit event
$cMySQLNames = "utf8mb4";
And the end result: