Linux SOGo calendar synchronization breaks due to emoji in the event title

Recently, I encountered an issue with the SOGo CalDAV synchronization. If an emoji is inserted in the event title, then the calendar would stop synchronizing across devices.

Admin

2 min read

An emoji can break a calendar. 😳

I am using the SOGo Groupware. I noticed that certain emojis in the event title would prevent calendar apps from synchronizing using the CalDAV protocol. I checked the logs but could not find much. I had my doubts about what could be causing it. Then, this bug report confirmed that I should investigate on the UTF-8 encoding support.

I checked the database character set.

MariaDB [sogo]> select @@character_set_database;
+--------------------------+
| @@character_set_database |
+--------------------------+
| utf8                     |
+--------------------------+
1 row in set (0.001 sec)

The database name is sogo and we are using MariaDB.

I found the character set to be utf8, to my surprise. I had to dig a little further to understand what was wrong with it.

It turned out that the MariaDB utf8 character set supports a maximum of three bytes per character. Therefore, emojis being four bytes long weren't being inserted into the database. Consequently, that breaks the calendar synchronization. The solution was to use the utf8mb4 character set which supports four bytes per multi-byte character.

I altered the database character set and collation.

MariaDB [sogo]> ALTER DATABASE sogo CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

I also applied it to every table in the database, e.g:

MariaDB [sogo]> ALTER TABLE sogo_store CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Afterwards, I could create events using an emoji in the title. The event would synchronize across my calendar apps but the emoji would not show. It would appear as four questions marks (????) instead.

SOGo calendar emoji issue
SOGo calendar emoji issue

A little bit of further digging and I found that SOGo needs to be made aware of the full unicode support. It should be specified in the /etc/sogo/sogo.conf configuration file.

MySQL4Encoding = "utf8mb4";

Restart the SOGo service. Emojis should be then accepted in the event titles.

I can now put my recurrent coffee breaks in the calendar. ☕


Credits:
Web vector created by stories - www.freepik.com