I'm trying to display emoji on screen, from the database, but some emojis works, some others doesn't.
Database version: 10.5.4-MariaDB
Database Collation: utf8mb4_general_ci
Table charset: utf8mb4_general_ci
On PHP I'm using a simple select (SELECT * FROM table_name)
And the table has the lines:
1 - Backlog ️
2 - Prioritized
3 - Doing ✏️
4 - On Hold ⏰
5 - Done ✅
6 - Archived
(Are exactly that, the direct emoji, without encoding)
When I try to do a "print" or "echo" on the select resultset, I got this:
1 - Backlog ?
2 - Prioritized ?
3 - Doing ✏️
4 - On Hold ⏰
5 - Done ✅
6 - Archived ?
But, if I try put the emoji directly on the code, like: <div class="title">Backlog ️</div>
It's working fine.
What can I do to store it on the database, and select/print without problems?
I really don't know if I'm doing it right, if should encode/decode before/after.
I've already tried to use utf8_encode
and utf8_decode
, but didn't work.
First, thanks to @miken32, for the direction.
I've found a solution that worked for me:
On the PDO connection, I wasn't declaring the charset collection, so the solution was:
From:
To:
And all keep same: