Emojis in the Database and Displayed by Wappler

I’m trying to store emojis in my database and then display them with Wappler.

Problem: Wappler is incorrectly displaying emojis.

Possible reasons that I can think of:

  • Wappler is incorrectly interpreting the DB
  • I’ve stored it incorrectly in my DB, but it shows up fine when I write my own PHP file to get the info from the database.

I’ve got my own (non Wappler) script that I made in php. It hits an IMAP mailbox, processes everything, sanitizes the text, figures out the MIME format, and decodes whatever it was in. Then it adds it to the Maria Database (like MySQL).

Ignore some of the, uh, “funny text”, I had a buddy send me texts from an iPhone for testing 'cause I only have an android. He thought he’d be funny.

PICTURE OF THE DATABASE
image

Picture of how it is displayed with my own PHP file that retrieves the info from the DB and echoes it out:
image

Picture of how Wappler displays it.

As you can see, Wappler is displaying it EXACTLY how it’s stored in the Database, rather than outputting it as an emoji.

So, I’m unsure why (1) my stuff interprets the MySQL code as emoji, correctly. Or (2) why Wappler doesn’t.
But my code works in Firefox, Chrome, and (GASP) Microsoft Edge.

I’ve tried changing the Charset to utf8mb4 in Wappler’s connection.php file as some other have done with success in this forum.

My database is charset utf8mb4 and collation utf8mb4_unicode_520_ci.
Any help is very much appreciated!

Here's how to set the encoding for your db connection:

Yes, @Teodor, I changed that. But, it still shows as displayed in the image above.

Unless there is something else I needed to do after I changed that, it’s still not working correctly.

Then probably the script which stores them in your database is not writing them correctly in your database.

Perhaps!
But, why can they be read successfully outside of Wappler?

(I’m going to go through the other pages with a fine-tooth comb assuming Wappler is doing it correctly)

I don't know how the emojis should look when stored correctly in the database using utf8mb4 encoding.

Well, at least you and I have the same train of thought. :+1: :joy:

image

For me, emojis show in the database manager – in my case DataGrip.

Only thing I set in wappler is character set.

In maria, support for utf8mb4 can be set at the server, the database, the table, and the column level, so make sure you are covered for your needs.

Here’s a couple of sql commands to check:

SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';

SHOW TABLE STATUS FROM `database_name`;

Thanks, Ken (and others).

I had gotten everything set properly in Wappler and the PHP page that I coded. I was sure of it.

So, yesterday I started doing some tests. I had set my database as charset utf8mb4 and collation utf8mb4_unicode_520_ci.

It should have worked, but upon further investigation the DB was NOT set with the proper charset. It was set to Latin 1. Even though it had been changed.

So I changed Wappler to read Latin 1 and it worked just fine… for now, most emojis can be read with Latin 1 but because of how bits are written it may break in the future… so it has to get fixed.

So I contacted some help with my server company. The first level guy couldn’t directly change the charset either. So, he’s elevated it to an engineer who is working on it.

My guess is, that will fix it.