0

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?

Community
  • 1
  • 1
Saulo Silva
  • 1,219
  • 1
  • 20
  • 37
  • could it be something as simple as adding `` to the `` section of your template...? seems like the hard coding test you ran would rule that out, though – morphatic Nov 06 '15 at 03:36
  • Right, and I already have the `` tag. – Saulo Silva Nov 06 '15 at 20:21
  • how about the font? could the page be trying to display the character in a font that doesn't have the symbol? again, not likely, but want to knock out the obvious, easy stuff first – morphatic Nov 06 '15 at 20:59
  • Nope, changed from Source Sans Pro to Arial, but it still doesn't work. Also, this would have been ruled out by the hardcoded emoji as well. – Saulo Silva Nov 06 '15 at 21:22

1 Answers1

0

Exactly 4 question marks? The Emoji is 4 bytes long. The likely cause is trying to transform non-latin1 characters into a CHARACTER SET latin1 column.

Check all these:

  • The column(s) in the database -- Use SHOW CREATE TABLE to verify that they are explicitly set to utf8, or defaulted from the table definition. (It is not enough to change the database default.)
  • The connection between the client and the server. See SET NAMES utf8.
  • The bytes you have. (This is probably the case.)
  • If you are displaying the text in a web page, check the <meta> tag.
Rick James
  • 135,179
  • 13
  • 127
  • 222