I can store emojis with php pdo at same hosting - database. But i'm not able to do it with node js.
Im using code below for myqsl connettion with Node js. But when i tried to save text with emoji, emojis saving to database as quesiton mark.
 var con = mysql.createConnection({
    host: '127.0.0.1',
    port: 3306,
    user: 'db_user',
    password: 'db_password',
    database: 'db_name',
    charset: 'utf8mb4',
});
  con.connect(
    function (err) {
        if (err) {
            console.log("ERROR: ");
            throw err;
        } else {
            con.query('INSERT INTO messages (message_from, message_to,message) VALUES (?, ?, ?);', [message_from, message_to,message_text],
                function (err, results, fields) {
                    if (err) throw err;
                    else console.log('Inserted ' + results.affectedRows + ' row(s).');
                });
            con.end(
                function (err) {
                    if (err) throw err;
                });
        }
    });
i also tried
collation: "utf8mb4_general_ci",
but not working anyway.
Edit: Table and data type also utf8mb4

I changed collation as comments says and it worked.
"utf8mb4_general_ci" to "utf8mb4_turkish_ci".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With