When we are using MySQL database, now days we need to integrate the smileys [Emoji] for any description or status texts.
Let’s an example that we need to save user bio into mysql database, then we can store emoji into status just like WhatsApp is storing the emoji into status or any description where user have full right to store any kind of emoji to their status for profile update.
But here we have a problem with Mysql Database, it doesn’t save automatically unicode language, we have to tell mysql that save into unicode [utf8mb4] for my charactor set.

If you are using Node JS for that, and using most popular plugin for mysql connectivity mysql then a quick thing will solve your problem.

Add charset : ‘utf8mb4’ in your mysql connection pool.

var connection = mysql.createConnection({
    host : 'you_ip',
    user : 'user',
    password : 'password',
    database : 'db',
    charset : 'utf8mb4'
});
Spread the love
Last modified: November 27, 2019

Comments

Write a Reply or Comment

Your email address will not be published.