Using Emoji with phpList

Hello,

How can I use Emoji in phpList? When I send a mail with an Emoji in it it will show like this: ???

Regards,
CD

Have you ever tried this icon?

Hi, thanks for your reply. Yes I used the smileys before, but that is not the same as Emoji. Hope someone can help me get emoji working.

I tested emoji in my environment.
It seems emoji showing well.

phplist

mail client
mail

  • OS: CentOS 7
  • PHPList: 3.5.3

I don’t have any problems with Emoji in preview mode. When I send the mail they will change to ???

And in your image you are using/ showing the smileys. I mean the Emoji’s. So please read my question in the fist post again :wink:

@CD130 Why emojis do not display properly has been discussed before on this forum. Just search to find the earlier posts.

Thanks for reply :slight_smile: I can’t find an old discussion with the search option. Maybe I’m doing something wrong?

@CD130 Searching for “emoji” gives me several results.
image

Thanks, I already checked all the results and can’t find the answer how to add Emoji in a mail in phpList :slight_smile:

Hello, @CD130

At least, you needs the following steps.
(I tried the following but I can’t store emoji properly yet. I succeed to store emoji as draft. And send a mail.)
sample

  • Use utf8mb4 character encoding in your database. (add my.cnf configuration)
  • Convert phplist DDL for using utf8mb4 instead of utf8 phpList Mantis
  • Modify DDL for avoding Specified key was too long; max key length is 767 bytes
  • modify utf8 -> utf8mb4 in public_html/lists/admin/mysqli.inc.
  • Maybe and something. I’m not sure rest of operation.

Emoji use four-bytes character in UTF-8 encoding.
You need to use utf8mb4 encoding instead of utf8 in your database.

like the following

show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8mb4                    |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | utf8mb4                    |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
show create table phplist_message
....
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 // <- Not utf8
1 Like

Wow!! So this works fine?? Why the makers of phpList won’t change this in the standard version? Then can everybody use Emojis in the mails :slight_smile:

Hello, @CD130

I don’t test all features. But, I succeed to send an email with Emoji.

I’m not sure whether all user needs to use Emoji. Generally, It requires more storage space.
And, It requires a database migration. (schema change.)
It will break compatibility.

2 Likes

It is possible to convert a phplist installation already installed to “emoji” capable by doing the following:

  1. change the mysqli.inc to refer to “utf8mb4” in every references to “utf8” (set names, charater set
  2. execute the change on database utf8mb4
  3. execute the change on the tables: config, template, message, messagedata, event_log
  4. optionally other tables can be changed: user_user_history, subscribepage, subscribepage_data, i18n

To change database codification method:

ALTER DATABASE
    database_name
    CHARACTER SET = utf8mb4
    COLLATE = utf8mb4_unicode_ci;

To change tables codification method:

ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`

For more information about this topic:

As always, be aware that you should make backups prior to any commands that make this kind of change on the database.

1 Like

Thanks @racribeiro! Definitely going to try this :crossed_fingers:

@racribeiro I really appreciate your solution!

Manually encoding stopped working recently. This is the better way.

For anyone else who enabled emojis and has since upgraded, you may find some emojis save while others are converted to question marks (??).

Since mysqli.inc is replaced during an upgrade, you need to restore the changes indicated in Step 1 of the post above by @racribeiro

1 Like