jeudi 5 novembre 2015

Unicode characters from DB not displayed correctly

On a MySQL table, the column release_notes is encoded in utf8mb4.

On the Laravel config/database.php file, the following is under the MySQL section:

'charset'   => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',

From a MySQL client, I set the value of that column to an emoji (e.g. "📌"). It is properly displayed on the MySQL client.

To display that column, on the Blade template I have the following:

{!! nl2br($app->release_notes) !!}

However, what ends up displaying on the browser is:

????

To verify this is not a browser/HTML problem, I hardcoded the emoji directly on the template file and it is displayed as expected.

I did try the accepted answer of this question, to no avail.

What am I missing?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire