0

I'm trying to using emoji in product review of Magento 2. I've changed database collation to utf8mb4 also the same thing for review table & column. Now emoji appear in database but in frontend it's still like ????.

Could you please help me.

1 Answer 1

2

If you have already changed the database collation to utf8mb4 and also updated the collation of the review table and its column, then the next step is to make sure that your Magento installation is configured to use utf8mb4 encoding as well.

To do this, you need to update the Magento database configuration file app/etc/env.php. Find the db section of the file and make sure that the charset parameter is set to utf8mb4. Here's an example:

 'db' => [
    'table_prefix' => '',
     'connection' => [
     'default' => [
        'host' => 'localhost',
        'dbname' => 'magento',
        'username' => 'magento',
        'password' => 'magento',
        'active' => '1',
        'charset' => 'utf8mb4'
     ]
   ]
 ],

Once you have updated the env.php file, clear the Magento cache by running the following command from your Magento root directory:

 php bin/magento cache:flush

After clearing the cache, the emoji should now be displayed correctly in the product review section of your Magento store.

5
  • Hi Navneet, Does Magento 2.4.5 support utf8mb4 ? also will this process effect negatively on my website ?
    – Dun7ill
    Mar 13, 2023 at 7:03
  • Yes, Magento 2.4.5 supports utf8mb4 character encoding. I don't think so this process impact negatively on your website. Mar 13, 2023 at 7:17
  • Dear Navneet, my env.php file contain this 'initStatements' => 'SET NAMES utf8; not charest !
    – Dun7ill
    Mar 13, 2023 at 8:15
  • Thanks a lot dear it's works now, I've changed utf8 to utf8mb4.
    – Dun7ill
    Mar 13, 2023 at 8:27
  • Kindly upvote my answer if you satisfied. Thanks Mar 13, 2023 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.